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