@primer/react 0.0.0-20260403170759 → 0.0.0-20260403172558
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 +3 -1
- package/dist/ActionBar/ActionBar-94abaa40.css +2 -0
- package/dist/ActionBar/ActionBar-94abaa40.css.map +1 -0
- package/dist/ActionBar/ActionBar.d.ts +1 -1
- package/dist/ActionBar/ActionBar.d.ts.map +1 -1
- package/dist/ActionBar/ActionBar.js +312 -367
- package/dist/ActionBar/ActionBar.module.css.js +2 -2
- package/dist/ActionBar/index.d.ts +1 -1
- package/dist/ActionList/List.d.ts.map +1 -1
- package/dist/ActionList/List.js +41 -41
- package/dist/AnchoredOverlay/AnchoredOverlay.d.ts.map +1 -1
- package/dist/AnchoredOverlay/AnchoredOverlay.js +13 -3
- package/dist/ButtonGroup/ButtonGroup.d.ts.map +1 -1
- package/dist/ButtonGroup/ButtonGroup.js +23 -23
- package/dist/Checkbox/Checkbox.d.ts.map +1 -1
- package/dist/Checkbox/Checkbox.js +5 -5
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +7 -5
- package/dist/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/PageHeader/PageHeader.js +31 -30
- package/dist/TextInput/TextInput.d.ts.map +1 -1
- package/dist/TextInput/TextInput.js +6 -5
- package/dist/TooltipV2/Tooltip.d.ts.map +1 -1
- package/dist/TooltipV2/Tooltip.js +4 -4
- package/dist/experimental/Tabs/Tabs.d.ts +1 -1
- package/dist/experimental/Tabs/Tabs.d.ts.map +1 -1
- package/dist/experimental/Tabs/Tabs.js +16 -16
- package/dist/hooks/useMergedRefs.d.ts +1 -1
- package/dist/hooks/useMergedRefs.d.ts.map +1 -1
- package/dist/hooks/useMergedRefs.js +1 -7
- package/dist/hooks/useProvidedRefOrCreate.d.ts +10 -7
- package/dist/hooks/useProvidedRefOrCreate.d.ts.map +1 -1
- package/dist/hooks/useProvidedRefOrCreate.js +10 -10
- package/package.json +1 -1
- package/dist/ActionBar/ActionBar-a41224b2.css +0 -2
- package/dist/ActionBar/ActionBar-a41224b2.css.map +0 -1
|
@@ -1,29 +1,19 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React, { useRef,
|
|
2
|
+
import React, { useRef, forwardRef, useState, useMemo, useCallback, useContext, useSyncExternalStore } from 'react';
|
|
3
3
|
import { KebabHorizontalIcon } from '@primer/octicons-react';
|
|
4
4
|
import { ActionList } from '../ActionList/index.js';
|
|
5
|
-
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
6
|
-
import { useResizeObserver } from '../hooks/useResizeObserver.js';
|
|
7
5
|
import { IconButton } from '../Button/IconButton.js';
|
|
8
6
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
9
7
|
import styles from './ActionBar.module.css.js';
|
|
10
8
|
import { clsx } from 'clsx';
|
|
11
9
|
import { createDescendantRegistry } from '../utils/descendant-registry.js';
|
|
12
|
-
import {
|
|
10
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
13
11
|
import { useMergedRefs } from '../hooks/useMergedRefs.js';
|
|
14
12
|
import { FocusKeys } from '@primer/behaviors';
|
|
15
13
|
import { ActionMenu } from '../ActionMenu/ActionMenu.js';
|
|
16
14
|
|
|
17
|
-
const ACTIONBAR_ITEM_GAP = 8;
|
|
18
|
-
|
|
19
|
-
/**
|
|
20
|
-
* Registry of descendants to render in the list or menu. To preserve insertion order across updates, children are
|
|
21
|
-
* set to `null` when unregistered rather than fully dropped from the map.
|
|
22
|
-
*/
|
|
23
|
-
|
|
24
15
|
const ActionBarContext = /*#__PURE__*/React.createContext({
|
|
25
16
|
size: 'medium',
|
|
26
|
-
isVisibleChild: () => true,
|
|
27
17
|
groupId: undefined
|
|
28
18
|
});
|
|
29
19
|
|
|
@@ -31,23 +21,7 @@ const ActionBarContext = /*#__PURE__*/React.createContext({
|
|
|
31
21
|
small (28px), medium (32px), large (40px)
|
|
32
22
|
*/
|
|
33
23
|
|
|
34
|
-
const MORE_BTN_WIDTH = 32;
|
|
35
24
|
const ActionBarItemsRegistry = createDescendantRegistry();
|
|
36
|
-
const calculatePossibleItems = (registryEntries, navWidth, gap, moreMenuWidth = 0) => {
|
|
37
|
-
const widthToFit = navWidth - moreMenuWidth;
|
|
38
|
-
let breakpoint = registryEntries.length; // assume all items will fit
|
|
39
|
-
let sumsOfChildWidth = 0;
|
|
40
|
-
for (const [index, [, child]] of registryEntries.entries()) {
|
|
41
|
-
sumsOfChildWidth += index > 0 ? child.width + gap : child.width;
|
|
42
|
-
if (sumsOfChildWidth > widthToFit) {
|
|
43
|
-
breakpoint = index;
|
|
44
|
-
break;
|
|
45
|
-
} else {
|
|
46
|
-
continue;
|
|
47
|
-
}
|
|
48
|
-
}
|
|
49
|
-
return breakpoint;
|
|
50
|
-
};
|
|
51
25
|
const renderMenuItem = (item, index) => {
|
|
52
26
|
if (item.type === 'divider') {
|
|
53
27
|
return /*#__PURE__*/jsx(ActionList.Divider, {}, index);
|
|
@@ -96,44 +70,8 @@ const renderMenuItem = (item, index) => {
|
|
|
96
70
|
}, label);
|
|
97
71
|
};
|
|
98
72
|
renderMenuItem.displayName = "renderMenuItem";
|
|
99
|
-
const getMenuItems = (navWidth, moreMenuWidth, childRegistry, hasActiveMenu, gap) => {
|
|
100
|
-
var _childRegistry$entrie;
|
|
101
|
-
const registryEntries = Array.from((_childRegistry$entrie = childRegistry === null || childRegistry === void 0 ? void 0 : childRegistry.entries()) !== null && _childRegistry$entrie !== void 0 ? _childRegistry$entrie : []).filter(entry => entry[1] !== null && (entry[1].type !== 'action' || entry[1].groupId === undefined));
|
|
102
|
-
if (registryEntries.length === 0) return new Set();
|
|
103
|
-
const numberOfItemsPossible = calculatePossibleItems(registryEntries, navWidth, gap);
|
|
104
|
-
const numberOfItemsPossibleWithMoreMenu = calculatePossibleItems(registryEntries, navWidth, gap, moreMenuWidth || MORE_BTN_WIDTH);
|
|
105
|
-
const menuItems = new Set();
|
|
106
|
-
|
|
107
|
-
// First, we check if we can fit all the items with their icons
|
|
108
|
-
if (registryEntries.length >= numberOfItemsPossible) {
|
|
109
|
-
/* Below is an accessibility requirement. Never show only one item in the overflow menu.
|
|
110
|
-
* If there is only one item left to display in the overflow menu according to the calculation,
|
|
111
|
-
* we need to pull another item from the list into the overflow menu.
|
|
112
|
-
*/
|
|
113
|
-
const numberOfItemsInMenu = registryEntries.length - numberOfItemsPossibleWithMoreMenu;
|
|
114
|
-
const numberOfListItems = numberOfItemsInMenu === 1 ? numberOfItemsPossibleWithMoreMenu - 1 : numberOfItemsPossibleWithMoreMenu;
|
|
115
|
-
for (const [index, [id, child]] of registryEntries.entries()) {
|
|
116
|
-
if (index < numberOfListItems) {
|
|
117
|
-
continue;
|
|
118
|
-
//if the last item is a divider
|
|
119
|
-
} else if (child.type === 'divider') {
|
|
120
|
-
if (index === numberOfListItems - 1 || index === numberOfListItems) {
|
|
121
|
-
continue;
|
|
122
|
-
} else {
|
|
123
|
-
menuItems.add(id);
|
|
124
|
-
}
|
|
125
|
-
} else {
|
|
126
|
-
menuItems.add(id);
|
|
127
|
-
}
|
|
128
|
-
}
|
|
129
|
-
return menuItems;
|
|
130
|
-
} else if (numberOfItemsPossible > registryEntries.length && hasActiveMenu) {
|
|
131
|
-
/* If the items fit in the list and there are items in the overflow menu, we need to move them back to the list */
|
|
132
|
-
return new Set();
|
|
133
|
-
}
|
|
134
|
-
};
|
|
135
73
|
const ActionBar = props => {
|
|
136
|
-
const $ = c(
|
|
74
|
+
const $ = c(41);
|
|
137
75
|
const {
|
|
138
76
|
size: t0,
|
|
139
77
|
children,
|
|
@@ -147,276 +85,273 @@ const ActionBar = props => {
|
|
|
147
85
|
const flush = t1 === undefined ? false : t1;
|
|
148
86
|
const gap = t2 === undefined ? "condensed" : t2;
|
|
149
87
|
const listRef = useRef(null);
|
|
150
|
-
const [computedGap, setComputedGap] = useState(ACTIONBAR_ITEM_GAP);
|
|
151
88
|
const [childRegistry, setChildRegistry] = ActionBarItemsRegistry.useRegistryState();
|
|
152
|
-
const [menuItemIds, setMenuItemIds] = useState(_temp);
|
|
153
89
|
const navRef = useRef(null);
|
|
154
90
|
let t3;
|
|
155
|
-
if ($[0]
|
|
156
|
-
t3 = ()
|
|
157
|
-
|
|
158
|
-
|
|
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;
|
|
91
|
+
if ($[0] !== childRegistry) {
|
|
92
|
+
t3 = childRegistry === null || childRegistry === void 0 ? void 0 : childRegistry.values().every(_temp);
|
|
93
|
+
$[0] = childRegistry;
|
|
94
|
+
$[1] = t3;
|
|
167
95
|
} else {
|
|
168
|
-
t3 = $[
|
|
96
|
+
t3 = $[1];
|
|
169
97
|
}
|
|
170
98
|
let t4;
|
|
171
|
-
if ($[
|
|
172
|
-
t4 =
|
|
173
|
-
|
|
99
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
100
|
+
t4 = (direction, from) => {
|
|
101
|
+
var _listRef$current$quer, _listRef$current;
|
|
102
|
+
const items = Array.from((_listRef$current$quer = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.querySelectorAll(":is(button, a, input, [tabindex]):not(:disabled):not([data-overflowing]):not([data-more-button-inactive])")) !== null && _listRef$current$quer !== void 0 ? _listRef$current$quer : []);
|
|
103
|
+
const fromIndex = from ? items.indexOf(from) : -1;
|
|
104
|
+
switch (direction) {
|
|
105
|
+
case "start":
|
|
106
|
+
{
|
|
107
|
+
return items[0];
|
|
108
|
+
}
|
|
109
|
+
case "end":
|
|
110
|
+
{
|
|
111
|
+
return items.at(-1);
|
|
112
|
+
}
|
|
113
|
+
case "next":
|
|
114
|
+
{
|
|
115
|
+
var _items;
|
|
116
|
+
return (_items = items[fromIndex + 1]) !== null && _items !== void 0 ? _items : items[0];
|
|
117
|
+
}
|
|
118
|
+
case "previous":
|
|
119
|
+
{
|
|
120
|
+
var _items2;
|
|
121
|
+
return (_items2 = items[fromIndex - 1]) !== null && _items2 !== void 0 ? _items2 : items.at(-1);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
};
|
|
174
125
|
$[2] = t4;
|
|
175
126
|
} else {
|
|
176
127
|
t4 = $[2];
|
|
177
128
|
}
|
|
178
|
-
useIsomorphicLayoutEffect(t3, t4);
|
|
179
|
-
const moreMenuRef = useRef(null);
|
|
180
129
|
let t5;
|
|
181
|
-
if ($[3] !==
|
|
182
|
-
t5 =
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
const newMenuItemIds = getMenuItems(navWidth, moreMenuWidth, childRegistry, hasActiveMenu, computedGap);
|
|
189
|
-
if (newMenuItemIds) {
|
|
190
|
-
setMenuItemIds(newMenuItemIds);
|
|
191
|
-
}
|
|
192
|
-
}
|
|
130
|
+
if ($[3] !== t3) {
|
|
131
|
+
t5 = {
|
|
132
|
+
containerRef: listRef,
|
|
133
|
+
bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
|
|
134
|
+
focusOutBehavior: "wrap",
|
|
135
|
+
disabled: t3,
|
|
136
|
+
getNextFocusable: t4
|
|
193
137
|
};
|
|
194
|
-
$[3] =
|
|
195
|
-
$[4] =
|
|
196
|
-
$[5] = menuItemIds.size;
|
|
197
|
-
$[6] = t5;
|
|
138
|
+
$[3] = t3;
|
|
139
|
+
$[4] = t5;
|
|
198
140
|
} else {
|
|
199
|
-
t5 = $[
|
|
141
|
+
t5 = $[4];
|
|
200
142
|
}
|
|
201
|
-
|
|
143
|
+
useFocusZone(t5);
|
|
202
144
|
let t6;
|
|
203
|
-
if ($[
|
|
204
|
-
t6 =
|
|
205
|
-
$[
|
|
206
|
-
$[
|
|
145
|
+
if ($[5] !== childRegistry) {
|
|
146
|
+
t6 = childRegistry && Array.from(childRegistry.entries()).filter(_temp2);
|
|
147
|
+
$[5] = childRegistry;
|
|
148
|
+
$[6] = t6;
|
|
207
149
|
} else {
|
|
208
|
-
t6 = $[
|
|
150
|
+
t6 = $[6];
|
|
209
151
|
}
|
|
210
|
-
const
|
|
152
|
+
const overflowItems = t6;
|
|
211
153
|
let t7;
|
|
212
|
-
if ($[
|
|
154
|
+
if ($[7] !== size) {
|
|
213
155
|
t7 = {
|
|
214
|
-
|
|
215
|
-
bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
|
|
216
|
-
focusOutBehavior: "wrap"
|
|
156
|
+
size
|
|
217
157
|
};
|
|
218
|
-
$[
|
|
219
|
-
|
|
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;
|
|
158
|
+
$[7] = size;
|
|
159
|
+
$[8] = t7;
|
|
235
160
|
} else {
|
|
236
|
-
|
|
161
|
+
t7 = $[8];
|
|
237
162
|
}
|
|
238
|
-
const groupedItems = groupedItemsMap;
|
|
239
163
|
let t8;
|
|
240
|
-
if ($[
|
|
241
|
-
t8 =
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
};
|
|
245
|
-
$[12] = isVisibleChild;
|
|
246
|
-
$[13] = size;
|
|
247
|
-
$[14] = t8;
|
|
164
|
+
if ($[9] !== className) {
|
|
165
|
+
t8 = clsx(className, styles.Nav);
|
|
166
|
+
$[9] = className;
|
|
167
|
+
$[10] = t8;
|
|
248
168
|
} else {
|
|
249
|
-
t8 = $[
|
|
250
|
-
}
|
|
251
|
-
let t9;
|
|
252
|
-
if ($[15] !== className) {
|
|
253
|
-
t9 = clsx(className, styles.Nav);
|
|
254
|
-
$[15] = className;
|
|
255
|
-
$[16] = t9;
|
|
256
|
-
} else {
|
|
257
|
-
t9 = $[16];
|
|
169
|
+
t8 = $[10];
|
|
258
170
|
}
|
|
171
|
+
const t9 = overflowItems ? overflowItems.length > 0 : undefined;
|
|
259
172
|
let t10;
|
|
260
|
-
if ($[
|
|
261
|
-
t10 = /*#__PURE__*/jsx(
|
|
262
|
-
|
|
263
|
-
children: children
|
|
264
|
-
});
|
|
265
|
-
$[17] = children;
|
|
266
|
-
$[18] = setChildRegistry;
|
|
267
|
-
$[19] = t10;
|
|
173
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
174
|
+
t10 = /*#__PURE__*/jsx("div", {});
|
|
175
|
+
$[11] = t10;
|
|
268
176
|
} else {
|
|
269
|
-
t10 = $[
|
|
177
|
+
t10 = $[11];
|
|
270
178
|
}
|
|
271
179
|
let t11;
|
|
272
|
-
if ($[
|
|
273
|
-
t11 =
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
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
|
-
})
|
|
180
|
+
if ($[12] !== children || $[13] !== setChildRegistry) {
|
|
181
|
+
t11 = /*#__PURE__*/jsxs("div", {
|
|
182
|
+
className: styles.OverflowContainer,
|
|
183
|
+
children: [t10, /*#__PURE__*/jsx(ActionBarItemsRegistry.Provider, {
|
|
184
|
+
setRegistry: setChildRegistry,
|
|
185
|
+
children: children
|
|
340
186
|
})]
|
|
341
187
|
});
|
|
342
|
-
$[
|
|
343
|
-
$[
|
|
344
|
-
$[
|
|
345
|
-
$[23] = menuItemIds;
|
|
346
|
-
$[24] = t11;
|
|
188
|
+
$[12] = children;
|
|
189
|
+
$[13] = setChildRegistry;
|
|
190
|
+
$[14] = t11;
|
|
347
191
|
} else {
|
|
348
|
-
t11 = $[
|
|
192
|
+
t11 = $[14];
|
|
349
193
|
}
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
194
|
+
const t12 = `More ${ariaLabel} items ${overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.length}`;
|
|
195
|
+
const t13 = overflowItems !== null && overflowItems !== void 0 && overflowItems.length ? undefined : true;
|
|
196
|
+
let t14;
|
|
197
|
+
if ($[15] !== size || $[16] !== t12 || $[17] !== t13) {
|
|
198
|
+
t14 = /*#__PURE__*/jsx(ActionMenu.Anchor, {
|
|
199
|
+
children: /*#__PURE__*/jsx(IconButton, {
|
|
200
|
+
variant: "invisible",
|
|
201
|
+
"aria-label": t12,
|
|
202
|
+
icon: KebabHorizontalIcon,
|
|
203
|
+
className: styles.MoreButton,
|
|
204
|
+
"data-more-button-inactive": t13,
|
|
205
|
+
size: size
|
|
206
|
+
})
|
|
207
|
+
});
|
|
208
|
+
$[15] = size;
|
|
209
|
+
$[16] = t12;
|
|
210
|
+
$[17] = t13;
|
|
211
|
+
$[18] = t14;
|
|
212
|
+
} else {
|
|
213
|
+
t14 = $[18];
|
|
214
|
+
}
|
|
215
|
+
let t15;
|
|
216
|
+
if ($[19] !== overflowItems) {
|
|
217
|
+
t15 = overflowItems === null || overflowItems === void 0 ? void 0 : overflowItems.map(_temp4);
|
|
218
|
+
$[19] = overflowItems;
|
|
219
|
+
$[20] = t15;
|
|
220
|
+
} else {
|
|
221
|
+
t15 = $[20];
|
|
222
|
+
}
|
|
223
|
+
let t16;
|
|
224
|
+
if ($[21] !== t15) {
|
|
225
|
+
t16 = /*#__PURE__*/jsx(ActionMenu.Overlay, {
|
|
226
|
+
children: /*#__PURE__*/jsx(ActionList, {
|
|
227
|
+
children: t15
|
|
228
|
+
})
|
|
229
|
+
});
|
|
230
|
+
$[21] = t15;
|
|
231
|
+
$[22] = t16;
|
|
232
|
+
} else {
|
|
233
|
+
t16 = $[22];
|
|
234
|
+
}
|
|
235
|
+
let t17;
|
|
236
|
+
if ($[23] !== t14 || $[24] !== t16) {
|
|
237
|
+
t17 = /*#__PURE__*/jsxs(ActionMenu, {
|
|
238
|
+
children: [t14, t16]
|
|
239
|
+
});
|
|
240
|
+
$[23] = t14;
|
|
241
|
+
$[24] = t16;
|
|
242
|
+
$[25] = t17;
|
|
243
|
+
} else {
|
|
244
|
+
t17 = $[25];
|
|
245
|
+
}
|
|
246
|
+
let t18;
|
|
247
|
+
if ($[26] !== ariaLabel || $[27] !== ariaLabelledBy || $[28] !== gap || $[29] !== size || $[30] !== t11 || $[31] !== t17 || $[32] !== t9) {
|
|
248
|
+
t18 = /*#__PURE__*/jsxs("div", {
|
|
353
249
|
ref: listRef,
|
|
354
250
|
role: "toolbar",
|
|
355
251
|
className: styles.List,
|
|
356
252
|
"aria-label": ariaLabel,
|
|
357
253
|
"aria-labelledby": ariaLabelledBy,
|
|
358
254
|
"data-gap": gap,
|
|
359
|
-
|
|
255
|
+
"data-size": size,
|
|
256
|
+
"data-has-overflow": t9,
|
|
257
|
+
children: [t11, t17]
|
|
360
258
|
});
|
|
361
|
-
$[
|
|
362
|
-
$[
|
|
363
|
-
$[
|
|
364
|
-
$[
|
|
365
|
-
$[
|
|
366
|
-
$[
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
259
|
+
$[26] = ariaLabel;
|
|
260
|
+
$[27] = ariaLabelledBy;
|
|
261
|
+
$[28] = gap;
|
|
262
|
+
$[29] = size;
|
|
263
|
+
$[30] = t11;
|
|
264
|
+
$[31] = t17;
|
|
265
|
+
$[32] = t9;
|
|
266
|
+
$[33] = t18;
|
|
267
|
+
} else {
|
|
268
|
+
t18 = $[33];
|
|
269
|
+
}
|
|
270
|
+
let t19;
|
|
271
|
+
if ($[34] !== flush || $[35] !== t18 || $[36] !== t8) {
|
|
272
|
+
t19 = /*#__PURE__*/jsx("div", {
|
|
373
273
|
ref: navRef,
|
|
374
|
-
className:
|
|
274
|
+
className: t8,
|
|
375
275
|
"data-flush": flush,
|
|
376
|
-
children:
|
|
276
|
+
children: t18
|
|
377
277
|
});
|
|
378
|
-
$[
|
|
379
|
-
$[
|
|
380
|
-
$[
|
|
381
|
-
$[
|
|
278
|
+
$[34] = flush;
|
|
279
|
+
$[35] = t18;
|
|
280
|
+
$[36] = t8;
|
|
281
|
+
$[37] = t19;
|
|
382
282
|
} else {
|
|
383
|
-
|
|
283
|
+
t19 = $[37];
|
|
384
284
|
}
|
|
385
|
-
let
|
|
386
|
-
if ($[
|
|
387
|
-
|
|
388
|
-
value:
|
|
389
|
-
children:
|
|
285
|
+
let t20;
|
|
286
|
+
if ($[38] !== t19 || $[39] !== t7) {
|
|
287
|
+
t20 = /*#__PURE__*/jsx(ActionBarContext.Provider, {
|
|
288
|
+
value: t7,
|
|
289
|
+
children: t19
|
|
390
290
|
});
|
|
391
|
-
$[
|
|
392
|
-
$[
|
|
393
|
-
$[
|
|
291
|
+
$[38] = t19;
|
|
292
|
+
$[39] = t7;
|
|
293
|
+
$[40] = t20;
|
|
394
294
|
} else {
|
|
395
|
-
|
|
295
|
+
t20 = $[40];
|
|
396
296
|
}
|
|
397
|
-
return
|
|
297
|
+
return t20;
|
|
398
298
|
};
|
|
399
|
-
function
|
|
400
|
-
|
|
401
|
-
const
|
|
299
|
+
function useActionBarItem(ref, registryProps) {
|
|
300
|
+
var _useContext;
|
|
301
|
+
const $ = c(8);
|
|
302
|
+
const isGroupOverflowing = (_useContext = useContext(ActionBarGroupContext)) === null || _useContext === void 0 ? void 0 : _useContext.isOverflowing;
|
|
303
|
+
const isInGroup = isGroupOverflowing !== undefined;
|
|
402
304
|
let t0;
|
|
305
|
+
if ($[0] !== isInGroup || $[1] !== ref) {
|
|
306
|
+
t0 = onChange => {
|
|
307
|
+
if (isInGroup) {
|
|
308
|
+
return _temp5;
|
|
309
|
+
}
|
|
310
|
+
const observer = new IntersectionObserver(() => onChange(), {
|
|
311
|
+
threshold: 1
|
|
312
|
+
});
|
|
313
|
+
if (ref.current) {
|
|
314
|
+
observer.observe(ref.current);
|
|
315
|
+
}
|
|
316
|
+
return () => observer.disconnect();
|
|
317
|
+
};
|
|
318
|
+
$[0] = isInGroup;
|
|
319
|
+
$[1] = ref;
|
|
320
|
+
$[2] = t0;
|
|
321
|
+
} else {
|
|
322
|
+
t0 = $[2];
|
|
323
|
+
}
|
|
324
|
+
const subscribeIntersectionObserver = t0;
|
|
403
325
|
let t1;
|
|
404
|
-
if ($[
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
326
|
+
if ($[3] !== ref) {
|
|
327
|
+
t1 = () => ref.current ? ref.current.offsetTop > 0 : false;
|
|
328
|
+
$[3] = ref;
|
|
329
|
+
$[4] = t1;
|
|
330
|
+
} else {
|
|
331
|
+
t1 = $[4];
|
|
332
|
+
}
|
|
333
|
+
const isItemOverflowing = useSyncExternalStore(subscribeIntersectionObserver, t1, _temp6);
|
|
334
|
+
const isOverflowing = isGroupOverflowing || isItemOverflowing;
|
|
335
|
+
ActionBarItemsRegistry.useRegisterDescendant(isOverflowing ? registryProps : null);
|
|
336
|
+
const t2 = isOverflowing ? "" : undefined;
|
|
337
|
+
let t3;
|
|
338
|
+
if ($[5] !== isOverflowing || $[6] !== t2) {
|
|
339
|
+
t3 = {
|
|
340
|
+
isOverflowing,
|
|
341
|
+
dataOverflowingAttr: t2
|
|
408
342
|
};
|
|
409
|
-
|
|
410
|
-
$[
|
|
411
|
-
$[
|
|
412
|
-
$[2] = t1;
|
|
343
|
+
$[5] = isOverflowing;
|
|
344
|
+
$[6] = t2;
|
|
345
|
+
$[7] = t3;
|
|
413
346
|
} else {
|
|
414
|
-
|
|
415
|
-
t1 = $[2];
|
|
347
|
+
t3 = $[7];
|
|
416
348
|
}
|
|
417
|
-
|
|
418
|
-
return width;
|
|
349
|
+
return t3;
|
|
419
350
|
}
|
|
351
|
+
function _temp6() {
|
|
352
|
+
return false;
|
|
353
|
+
}
|
|
354
|
+
function _temp5() {}
|
|
420
355
|
const ActionBarIconButton = /*#__PURE__*/forwardRef(({
|
|
421
356
|
disabled,
|
|
422
357
|
onClick,
|
|
@@ -425,44 +360,36 @@ const ActionBarIconButton = /*#__PURE__*/forwardRef(({
|
|
|
425
360
|
const ref = useRef(null);
|
|
426
361
|
const mergedRef = useMergedRefs(ref, forwardedRef);
|
|
427
362
|
const {
|
|
428
|
-
size
|
|
429
|
-
isVisibleChild
|
|
363
|
+
size
|
|
430
364
|
} = React.useContext(ActionBarContext);
|
|
431
|
-
const {
|
|
432
|
-
groupId
|
|
433
|
-
} = React.useContext(ActionBarGroupContext);
|
|
434
|
-
const width = useWidth(ref);
|
|
435
365
|
const {
|
|
436
366
|
['aria-label']: ariaLabel,
|
|
437
367
|
icon
|
|
438
368
|
} = props;
|
|
439
|
-
const
|
|
369
|
+
const {
|
|
370
|
+
dataOverflowingAttr
|
|
371
|
+
} = useActionBarItem(ref, useMemo(() => ({
|
|
440
372
|
type: 'action',
|
|
441
373
|
label: ariaLabel !== null && ariaLabel !== void 0 ? ariaLabel : '',
|
|
442
374
|
icon,
|
|
443
375
|
disabled: !!disabled,
|
|
444
|
-
onClick: onClick
|
|
445
|
-
|
|
446
|
-
groupId: groupId !== null && groupId !== void 0 ? groupId : undefined
|
|
447
|
-
}), [ariaLabel, icon, disabled, onClick, groupId, width]);
|
|
448
|
-
const id = ActionBarItemsRegistry.useRegisterDescendant(registryProps);
|
|
376
|
+
onClick: onClick
|
|
377
|
+
}), [ariaLabel, icon, disabled, onClick]));
|
|
449
378
|
const clickHandler = useCallback(event => {
|
|
450
379
|
if (disabled) return;
|
|
451
380
|
onClick === null || onClick === void 0 ? void 0 : onClick(event);
|
|
452
381
|
}, [disabled, onClick]);
|
|
453
|
-
if (!isVisibleChild(id) || groupId && !isVisibleChild(groupId)) return null;
|
|
454
382
|
return /*#__PURE__*/jsx(IconButton, {
|
|
455
383
|
"aria-disabled": disabled,
|
|
456
384
|
ref: mergedRef,
|
|
457
385
|
size: size,
|
|
458
386
|
onClick: clickHandler,
|
|
459
387
|
...props,
|
|
460
|
-
variant: "invisible"
|
|
388
|
+
variant: "invisible",
|
|
389
|
+
"data-overflowing": dataOverflowingAttr
|
|
461
390
|
});
|
|
462
391
|
});
|
|
463
|
-
const ActionBarGroupContext = /*#__PURE__*/React.createContext(
|
|
464
|
-
groupId: null
|
|
465
|
-
});
|
|
392
|
+
const ActionBarGroupContext = /*#__PURE__*/React.createContext(null);
|
|
466
393
|
const ActionBarGroup = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
467
394
|
const $ = c(10);
|
|
468
395
|
const {
|
|
@@ -470,38 +397,39 @@ const ActionBarGroup = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
470
397
|
} = t0;
|
|
471
398
|
const backupRef = useRef(null);
|
|
472
399
|
const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
473
|
-
const width = useWidth(ref);
|
|
474
400
|
let t1;
|
|
475
|
-
if ($[0]
|
|
401
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
476
402
|
t1 = {
|
|
477
|
-
type: "group"
|
|
478
|
-
width
|
|
403
|
+
type: "group"
|
|
479
404
|
};
|
|
480
|
-
$[0] =
|
|
481
|
-
$[1] = t1;
|
|
405
|
+
$[0] = t1;
|
|
482
406
|
} else {
|
|
483
|
-
t1 = $[
|
|
407
|
+
t1 = $[0];
|
|
484
408
|
}
|
|
485
|
-
const
|
|
486
|
-
|
|
409
|
+
const {
|
|
410
|
+
dataOverflowingAttr,
|
|
411
|
+
isOverflowing
|
|
412
|
+
} = useActionBarItem(ref, t1);
|
|
487
413
|
let t2;
|
|
488
|
-
if ($[
|
|
414
|
+
if ($[1] !== isOverflowing) {
|
|
489
415
|
t2 = {
|
|
490
|
-
|
|
416
|
+
isOverflowing
|
|
491
417
|
};
|
|
492
|
-
$[
|
|
493
|
-
$[
|
|
418
|
+
$[1] = isOverflowing;
|
|
419
|
+
$[2] = t2;
|
|
494
420
|
} else {
|
|
495
|
-
t2 = $[
|
|
421
|
+
t2 = $[2];
|
|
496
422
|
}
|
|
497
423
|
let t3;
|
|
498
|
-
if ($[
|
|
424
|
+
if ($[3] !== children || $[4] !== dataOverflowingAttr || $[5] !== ref) {
|
|
499
425
|
t3 = /*#__PURE__*/jsx("div", {
|
|
500
426
|
className: styles.Group,
|
|
501
427
|
ref: ref,
|
|
428
|
+
"data-overflowing": dataOverflowingAttr,
|
|
502
429
|
children: children
|
|
503
430
|
});
|
|
504
|
-
$[
|
|
431
|
+
$[3] = children;
|
|
432
|
+
$[4] = dataOverflowingAttr;
|
|
505
433
|
$[5] = ref;
|
|
506
434
|
$[6] = t3;
|
|
507
435
|
} else {
|
|
@@ -555,17 +483,12 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
555
483
|
}
|
|
556
484
|
const backupRef = useRef(null);
|
|
557
485
|
const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
558
|
-
const {
|
|
559
|
-
isVisibleChild
|
|
560
|
-
} = React.useContext(ActionBarContext);
|
|
561
486
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
562
|
-
const width = useWidth(ref);
|
|
563
487
|
const t1 = overflowIcon ? overflowIcon : icon;
|
|
564
488
|
let t2;
|
|
565
|
-
if ($[7] !== ariaLabel || $[8] !== items || $[9] !== returnFocusRef || $[10] !== t1
|
|
489
|
+
if ($[7] !== ariaLabel || $[8] !== items || $[9] !== returnFocusRef || $[10] !== t1) {
|
|
566
490
|
t2 = {
|
|
567
491
|
type: "menu",
|
|
568
|
-
width,
|
|
569
492
|
label: ariaLabel,
|
|
570
493
|
icon: t1,
|
|
571
494
|
returnFocusRef,
|
|
@@ -575,27 +498,26 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
575
498
|
$[8] = items;
|
|
576
499
|
$[9] = returnFocusRef;
|
|
577
500
|
$[10] = t1;
|
|
578
|
-
$[11] =
|
|
579
|
-
$[12] = t2;
|
|
501
|
+
$[11] = t2;
|
|
580
502
|
} else {
|
|
581
|
-
t2 = $[
|
|
582
|
-
}
|
|
583
|
-
const registryProps = t2;
|
|
584
|
-
const id = ActionBarItemsRegistry.useRegisterDescendant(registryProps);
|
|
585
|
-
if (!isVisibleChild(id)) {
|
|
586
|
-
return null;
|
|
503
|
+
t2 = $[11];
|
|
587
504
|
}
|
|
505
|
+
const {
|
|
506
|
+
dataOverflowingAttr
|
|
507
|
+
} = useActionBarItem(ref, t2);
|
|
588
508
|
let t3;
|
|
589
|
-
if ($[
|
|
509
|
+
if ($[12] !== ariaLabel || $[13] !== dataOverflowingAttr || $[14] !== icon || $[15] !== props) {
|
|
590
510
|
t3 = /*#__PURE__*/jsx(ActionMenu.Anchor, {
|
|
591
511
|
children: /*#__PURE__*/jsx(IconButton, {
|
|
592
512
|
variant: "invisible",
|
|
593
513
|
"aria-label": ariaLabel,
|
|
594
514
|
icon: icon,
|
|
595
|
-
...props
|
|
515
|
+
...props,
|
|
516
|
+
"data-overflowing": dataOverflowingAttr
|
|
596
517
|
})
|
|
597
518
|
});
|
|
598
|
-
$[
|
|
519
|
+
$[12] = ariaLabel;
|
|
520
|
+
$[13] = dataOverflowingAttr;
|
|
599
521
|
$[14] = icon;
|
|
600
522
|
$[15] = props;
|
|
601
523
|
$[16] = t3;
|
|
@@ -614,7 +536,7 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
614
536
|
}
|
|
615
537
|
let t5;
|
|
616
538
|
if ($[19] !== items) {
|
|
617
|
-
t5 = items.map(
|
|
539
|
+
t5 = items.map(_temp7);
|
|
618
540
|
$[19] = items;
|
|
619
541
|
$[20] = t5;
|
|
620
542
|
} else {
|
|
@@ -663,68 +585,91 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
663
585
|
const VerticalDivider = () => {
|
|
664
586
|
const $ = c(3);
|
|
665
587
|
const ref = useRef(null);
|
|
666
|
-
const {
|
|
667
|
-
isVisibleChild
|
|
668
|
-
} = React.useContext(ActionBarContext);
|
|
669
|
-
const width = useWidth(ref);
|
|
670
588
|
let t0;
|
|
671
|
-
if ($[0]
|
|
589
|
+
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
672
590
|
t0 = {
|
|
673
|
-
type: "divider"
|
|
674
|
-
width
|
|
591
|
+
type: "divider"
|
|
675
592
|
};
|
|
676
|
-
$[0] =
|
|
677
|
-
$[1] = t0;
|
|
593
|
+
$[0] = t0;
|
|
678
594
|
} else {
|
|
679
|
-
t0 = $[
|
|
680
|
-
}
|
|
681
|
-
const registryProps = t0;
|
|
682
|
-
const id = ActionBarItemsRegistry.useRegisterDescendant(registryProps);
|
|
683
|
-
if (!isVisibleChild(id)) {
|
|
684
|
-
return null;
|
|
595
|
+
t0 = $[0];
|
|
685
596
|
}
|
|
597
|
+
const {
|
|
598
|
+
dataOverflowingAttr
|
|
599
|
+
} = useActionBarItem(ref, t0);
|
|
686
600
|
let t1;
|
|
687
|
-
if ($[
|
|
601
|
+
if ($[1] !== dataOverflowingAttr) {
|
|
688
602
|
t1 = /*#__PURE__*/jsx("div", {
|
|
689
603
|
ref: ref,
|
|
690
604
|
"data-component": "ActionBar.VerticalDivider",
|
|
691
605
|
"aria-hidden": "true",
|
|
692
|
-
className: styles.Divider
|
|
606
|
+
className: styles.Divider,
|
|
607
|
+
"data-overflowing": dataOverflowingAttr
|
|
693
608
|
});
|
|
609
|
+
$[1] = dataOverflowingAttr;
|
|
694
610
|
$[2] = t1;
|
|
695
611
|
} else {
|
|
696
612
|
t1 = $[2];
|
|
697
613
|
}
|
|
698
614
|
return t1;
|
|
699
615
|
};
|
|
700
|
-
function _temp() {
|
|
701
|
-
return
|
|
616
|
+
function _temp(v) {
|
|
617
|
+
return v !== null;
|
|
702
618
|
}
|
|
703
|
-
function _temp2(
|
|
619
|
+
function _temp2(entry) {
|
|
620
|
+
return entry[1] !== null;
|
|
621
|
+
}
|
|
622
|
+
function _temp3(item, index) {
|
|
704
623
|
return renderMenuItem(item, index);
|
|
705
624
|
}
|
|
706
|
-
function
|
|
707
|
-
const [
|
|
708
|
-
if (
|
|
625
|
+
function _temp4(t0) {
|
|
626
|
+
const [id, menuItem] = t0;
|
|
627
|
+
if (menuItem.type === "divider") {
|
|
628
|
+
return /*#__PURE__*/jsx(ActionList.Divider, {}, id);
|
|
629
|
+
}
|
|
630
|
+
if (menuItem.type === "action") {
|
|
709
631
|
const {
|
|
710
|
-
onClick
|
|
711
|
-
icon:
|
|
712
|
-
label
|
|
713
|
-
disabled
|
|
714
|
-
} =
|
|
632
|
+
onClick,
|
|
633
|
+
icon: Icon,
|
|
634
|
+
label,
|
|
635
|
+
disabled
|
|
636
|
+
} = menuItem;
|
|
715
637
|
return /*#__PURE__*/jsxs(ActionList.Item, {
|
|
716
|
-
onSelect:
|
|
717
|
-
typeof
|
|
638
|
+
onSelect: event => {
|
|
639
|
+
typeof onClick === "function" && onClick(event);
|
|
718
640
|
},
|
|
719
|
-
disabled:
|
|
641
|
+
disabled: disabled,
|
|
720
642
|
children: [/*#__PURE__*/jsx(ActionList.LeadingVisual, {
|
|
721
|
-
children: /*#__PURE__*/jsx(
|
|
722
|
-
}),
|
|
723
|
-
},
|
|
643
|
+
children: /*#__PURE__*/jsx(Icon, {})
|
|
644
|
+
}), label]
|
|
645
|
+
}, label);
|
|
646
|
+
}
|
|
647
|
+
if (menuItem.type === "menu") {
|
|
648
|
+
const menuItems = menuItem.items;
|
|
649
|
+
const {
|
|
650
|
+
icon: Icon_0,
|
|
651
|
+
label: label_0,
|
|
652
|
+
returnFocusRef
|
|
653
|
+
} = menuItem;
|
|
654
|
+
return /*#__PURE__*/jsxs(ActionMenu, {
|
|
655
|
+
children: [/*#__PURE__*/jsx(ActionMenu.Anchor, {
|
|
656
|
+
children: /*#__PURE__*/jsxs(ActionList.Item, {
|
|
657
|
+
children: [Icon_0 !== "none" ? /*#__PURE__*/jsx(ActionList.LeadingVisual, {
|
|
658
|
+
children: /*#__PURE__*/jsx(Icon_0, {})
|
|
659
|
+
}) : null, label_0]
|
|
660
|
+
})
|
|
661
|
+
}), /*#__PURE__*/jsx(ActionMenu.Overlay, {
|
|
662
|
+
...(returnFocusRef && {
|
|
663
|
+
returnFocusRef
|
|
664
|
+
}),
|
|
665
|
+
children: /*#__PURE__*/jsx(ActionList, {
|
|
666
|
+
children: menuItems.map(_temp3)
|
|
667
|
+
})
|
|
668
|
+
})]
|
|
669
|
+
}, id);
|
|
724
670
|
}
|
|
725
|
-
return null;
|
|
726
671
|
}
|
|
727
|
-
function
|
|
672
|
+
function _temp7(item, index) {
|
|
728
673
|
return renderMenuItem(item, index);
|
|
729
674
|
}
|
|
730
675
|
|