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