@primer/react 0.0.0-20260303140539 → 0.0.0-20260303141644
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 +1 -4
- package/dist/ActionBar/ActionBar.d.ts.map +1 -1
- package/dist/ActionBar/ActionBar.js +431 -281
- package/package.json +1 -1
- package/dist/utils/descendant-registry.d.ts +0 -32
- package/dist/utils/descendant-registry.d.ts.map +0 -1
- package/dist/utils/descendant-registry.js +0 -222
package/CHANGELOG.md
CHANGED
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
# @primer/react
|
|
2
2
|
|
|
3
|
-
## 0.0.0-
|
|
3
|
+
## 0.0.0-20260303141644
|
|
4
4
|
|
|
5
5
|
### Patch Changes
|
|
6
6
|
|
|
7
7
|
- Fake entry to force publishing
|
|
8
8
|
|
|
9
|
-
- [#7506](https://github.com/primer/react/pull/7506) [`dea0dd0`](https://github.com/primer/react/commit/dea0dd0c6dcff6890a620f0708f1f28472a4fb98) Thanks [@iansan5653](https://github.com/iansan5653)! - - Fixes a bug where `ActionBar` menu items would be out of order if new items were mounted after the initial render
|
|
10
|
-
- Improves initial render performance for `ActionBar`
|
|
11
|
-
|
|
12
9
|
## 38.14.0
|
|
13
10
|
|
|
14
11
|
### Minor Changes
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ActionBar.d.ts","sourceRoot":"","sources":["../../src/ActionBar/ActionBar.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"ActionBar.d.ts","sourceRoot":"","sources":["../../src/ActionBar/ActionBar.tsx"],"names":[],"mappings":"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"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import React, { useRef, useState, forwardRef,
|
|
2
|
+
import React, { useRef, useState, forwardRef, useId } from 'react';
|
|
3
3
|
import { KebabHorizontalIcon } from '@primer/octicons-react';
|
|
4
4
|
import { ActionList } from '../ActionList/index.js';
|
|
5
5
|
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
@@ -8,7 +8,6 @@ import { IconButton } from '../Button/IconButton.js';
|
|
|
8
8
|
import { useFocusZone } from '../hooks/useFocusZone.js';
|
|
9
9
|
import styles from './ActionBar.module.css.js';
|
|
10
10
|
import { clsx } from 'clsx';
|
|
11
|
-
import { createDescendantRegistry } from '../utils/descendant-registry.js';
|
|
12
11
|
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
13
12
|
import { useRefObjectAsForwardedRef } from '../hooks/useRefObjectAsForwardedRef.js';
|
|
14
13
|
import { FocusKeys } from '@primer/behaviors';
|
|
@@ -23,6 +22,8 @@ const ACTIONBAR_ITEM_GAP = 8;
|
|
|
23
22
|
|
|
24
23
|
const ActionBarContext = /*#__PURE__*/React.createContext({
|
|
25
24
|
size: 'medium',
|
|
25
|
+
registerChild: () => {},
|
|
26
|
+
unregisterChild: () => {},
|
|
26
27
|
isVisibleChild: () => true,
|
|
27
28
|
groupId: undefined
|
|
28
29
|
});
|
|
@@ -32,7 +33,6 @@ small (28px), medium (32px), large (40px)
|
|
|
32
33
|
*/
|
|
33
34
|
|
|
34
35
|
const MORE_BTN_WIDTH = 32;
|
|
35
|
-
const ActionBarItemsRegistry = createDescendantRegistry();
|
|
36
36
|
const calculatePossibleItems = (registryEntries, navWidth, gap, moreMenuWidth = 0) => {
|
|
37
37
|
const widthToFit = navWidth - moreMenuWidth;
|
|
38
38
|
let breakpoint = registryEntries.length; // assume all items will fit
|
|
@@ -97,8 +97,7 @@ const renderMenuItem = (item, index) => {
|
|
|
97
97
|
};
|
|
98
98
|
renderMenuItem.displayName = "renderMenuItem";
|
|
99
99
|
const getMenuItems = (navWidth, moreMenuWidth, childRegistry, hasActiveMenu, gap) => {
|
|
100
|
-
|
|
101
|
-
const registryEntries = Array.from((_childRegistry$entrie = childRegistry === null || childRegistry === void 0 ? void 0 : childRegistry.entries()) !== null && _childRegistry$entrie !== void 0 ? _childRegistry$entrie : []).filter(entry => entry[1] !== null && (entry[1].type !== 'action' || entry[1].groupId === undefined));
|
|
100
|
+
const registryEntries = Array.from(childRegistry).filter(entry => entry[1] !== null && (entry[1].type !== 'action' || entry[1].groupId === undefined));
|
|
102
101
|
if (registryEntries.length === 0) return new Set();
|
|
103
102
|
const numberOfItemsPossible = calculatePossibleItems(registryEntries, navWidth, gap);
|
|
104
103
|
const numberOfItemsPossibleWithMoreMenu = calculatePossibleItems(registryEntries, navWidth, gap, moreMenuWidth || MORE_BTN_WIDTH);
|
|
@@ -133,7 +132,7 @@ const getMenuItems = (navWidth, moreMenuWidth, childRegistry, hasActiveMenu, gap
|
|
|
133
132
|
}
|
|
134
133
|
};
|
|
135
134
|
const ActionBar = props => {
|
|
136
|
-
const $ = c(
|
|
135
|
+
const $ = c(37);
|
|
137
136
|
const {
|
|
138
137
|
size: t0,
|
|
139
138
|
children,
|
|
@@ -148,12 +147,28 @@ const ActionBar = props => {
|
|
|
148
147
|
const gap = t2 === undefined ? "condensed" : t2;
|
|
149
148
|
const listRef = useRef(null);
|
|
150
149
|
const [computedGap, setComputedGap] = useState(ACTIONBAR_ITEM_GAP);
|
|
151
|
-
const [childRegistry, setChildRegistry] =
|
|
152
|
-
const [menuItemIds, setMenuItemIds] = useState(_temp);
|
|
153
|
-
const navRef = useRef(null);
|
|
150
|
+
const [childRegistry, setChildRegistry] = useState(_temp);
|
|
154
151
|
let t3;
|
|
155
152
|
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
156
|
-
t3 = () =>
|
|
153
|
+
t3 = (id, childProps) => setChildRegistry(prev => new Map(prev).set(id, childProps));
|
|
154
|
+
$[0] = t3;
|
|
155
|
+
} else {
|
|
156
|
+
t3 = $[0];
|
|
157
|
+
}
|
|
158
|
+
const registerChild = t3;
|
|
159
|
+
let t4;
|
|
160
|
+
if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
|
|
161
|
+
t4 = id_0 => setChildRegistry(prev_0 => new Map(prev_0).set(id_0, null));
|
|
162
|
+
$[1] = t4;
|
|
163
|
+
} else {
|
|
164
|
+
t4 = $[1];
|
|
165
|
+
}
|
|
166
|
+
const unregisterChild = t4;
|
|
167
|
+
const [menuItemIds, setMenuItemIds] = useState(_temp2);
|
|
168
|
+
const navRef = useRef(null);
|
|
169
|
+
let t5;
|
|
170
|
+
if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
|
|
171
|
+
t5 = () => {
|
|
157
172
|
if (!listRef.current) {
|
|
158
173
|
return;
|
|
159
174
|
}
|
|
@@ -163,23 +178,23 @@ const ActionBar = props => {
|
|
|
163
178
|
setComputedGap(parsed);
|
|
164
179
|
}
|
|
165
180
|
};
|
|
166
|
-
$[
|
|
181
|
+
$[2] = t5;
|
|
167
182
|
} else {
|
|
168
|
-
|
|
183
|
+
t5 = $[2];
|
|
169
184
|
}
|
|
170
|
-
let
|
|
171
|
-
if ($[
|
|
172
|
-
|
|
173
|
-
$[
|
|
174
|
-
$[
|
|
185
|
+
let t6;
|
|
186
|
+
if ($[3] !== gap) {
|
|
187
|
+
t6 = [gap];
|
|
188
|
+
$[3] = gap;
|
|
189
|
+
$[4] = t6;
|
|
175
190
|
} else {
|
|
176
|
-
|
|
191
|
+
t6 = $[4];
|
|
177
192
|
}
|
|
178
|
-
useIsomorphicLayoutEffect(
|
|
193
|
+
useIsomorphicLayoutEffect(t5, t6);
|
|
179
194
|
const moreMenuRef = useRef(null);
|
|
180
|
-
let
|
|
181
|
-
if ($[
|
|
182
|
-
|
|
195
|
+
let t7;
|
|
196
|
+
if ($[5] !== childRegistry || $[6] !== computedGap || $[7] !== menuItemIds.size) {
|
|
197
|
+
t7 = resizeObserverEntries => {
|
|
183
198
|
var _moreMenuRef$current$, _moreMenuRef$current;
|
|
184
199
|
const navWidth = resizeObserverEntries[0].contentRect.width;
|
|
185
200
|
const moreMenuWidth = (_moreMenuRef$current$ = (_moreMenuRef$current = moreMenuRef.current) === null || _moreMenuRef$current === void 0 ? void 0 : _moreMenuRef$current.getBoundingClientRect().width) !== null && _moreMenuRef$current$ !== void 0 ? _moreMenuRef$current$ : 0;
|
|
@@ -191,86 +206,76 @@ const ActionBar = props => {
|
|
|
191
206
|
}
|
|
192
207
|
}
|
|
193
208
|
};
|
|
194
|
-
$[
|
|
195
|
-
$[
|
|
196
|
-
$[
|
|
197
|
-
$[
|
|
209
|
+
$[5] = childRegistry;
|
|
210
|
+
$[6] = computedGap;
|
|
211
|
+
$[7] = menuItemIds.size;
|
|
212
|
+
$[8] = t7;
|
|
198
213
|
} else {
|
|
199
|
-
|
|
214
|
+
t7 = $[8];
|
|
200
215
|
}
|
|
201
|
-
useResizeObserver(
|
|
202
|
-
let
|
|
203
|
-
if ($[
|
|
204
|
-
|
|
205
|
-
$[
|
|
206
|
-
$[
|
|
216
|
+
useResizeObserver(t7, navRef);
|
|
217
|
+
let t8;
|
|
218
|
+
if ($[9] !== menuItemIds) {
|
|
219
|
+
t8 = id_1 => !menuItemIds.has(id_1);
|
|
220
|
+
$[9] = menuItemIds;
|
|
221
|
+
$[10] = t8;
|
|
207
222
|
} else {
|
|
208
|
-
|
|
223
|
+
t8 = $[10];
|
|
209
224
|
}
|
|
210
|
-
const isVisibleChild =
|
|
211
|
-
let
|
|
212
|
-
if ($[
|
|
213
|
-
|
|
225
|
+
const isVisibleChild = t8;
|
|
226
|
+
let t9;
|
|
227
|
+
if ($[11] === Symbol.for("react.memo_cache_sentinel")) {
|
|
228
|
+
t9 = {
|
|
214
229
|
containerRef: listRef,
|
|
215
230
|
bindKeys: FocusKeys.ArrowHorizontal | FocusKeys.HomeAndEnd,
|
|
216
231
|
focusOutBehavior: "wrap"
|
|
217
232
|
};
|
|
218
|
-
$[
|
|
233
|
+
$[11] = t9;
|
|
219
234
|
} else {
|
|
220
|
-
|
|
235
|
+
t9 = $[11];
|
|
221
236
|
}
|
|
222
|
-
useFocusZone(
|
|
237
|
+
useFocusZone(t9);
|
|
223
238
|
let groupedItemsMap;
|
|
224
|
-
if ($[
|
|
239
|
+
if ($[12] !== childRegistry) {
|
|
225
240
|
groupedItemsMap = new Map();
|
|
226
|
-
for (const [key,
|
|
227
|
-
if (
|
|
228
|
-
const existingGroup = groupedItemsMap.get(
|
|
229
|
-
existingGroup.push([key,
|
|
230
|
-
groupedItemsMap.set(
|
|
241
|
+
for (const [key, childProps_0] of childRegistry) {
|
|
242
|
+
if ((childProps_0 === null || childProps_0 === void 0 ? void 0 : childProps_0.type) === "action" && childProps_0.groupId) {
|
|
243
|
+
const existingGroup = groupedItemsMap.get(childProps_0.groupId) || [];
|
|
244
|
+
existingGroup.push([key, childProps_0]);
|
|
245
|
+
groupedItemsMap.set(childProps_0.groupId, existingGroup);
|
|
231
246
|
}
|
|
232
247
|
}
|
|
233
|
-
$[
|
|
234
|
-
$[
|
|
248
|
+
$[12] = childRegistry;
|
|
249
|
+
$[13] = groupedItemsMap;
|
|
235
250
|
} else {
|
|
236
|
-
groupedItemsMap = $[
|
|
251
|
+
groupedItemsMap = $[13];
|
|
237
252
|
}
|
|
238
253
|
const groupedItems = groupedItemsMap;
|
|
239
|
-
let
|
|
240
|
-
if ($[
|
|
241
|
-
|
|
254
|
+
let t10;
|
|
255
|
+
if ($[14] !== isVisibleChild || $[15] !== size) {
|
|
256
|
+
t10 = {
|
|
242
257
|
size,
|
|
258
|
+
registerChild,
|
|
259
|
+
unregisterChild,
|
|
243
260
|
isVisibleChild
|
|
244
261
|
};
|
|
245
|
-
$[
|
|
246
|
-
$[
|
|
247
|
-
$[
|
|
248
|
-
} else {
|
|
249
|
-
t8 = $[14];
|
|
250
|
-
}
|
|
251
|
-
let t9;
|
|
252
|
-
if ($[15] !== className) {
|
|
253
|
-
t9 = clsx(className, styles.Nav);
|
|
254
|
-
$[15] = className;
|
|
255
|
-
$[16] = t9;
|
|
262
|
+
$[14] = isVisibleChild;
|
|
263
|
+
$[15] = size;
|
|
264
|
+
$[16] = t10;
|
|
256
265
|
} else {
|
|
257
|
-
|
|
266
|
+
t10 = $[16];
|
|
258
267
|
}
|
|
259
|
-
let
|
|
260
|
-
if ($[17] !==
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
});
|
|
265
|
-
$[17] = children;
|
|
266
|
-
$[18] = setChildRegistry;
|
|
267
|
-
$[19] = t10;
|
|
268
|
+
let t11;
|
|
269
|
+
if ($[17] !== className) {
|
|
270
|
+
t11 = clsx(className, styles.Nav);
|
|
271
|
+
$[17] = className;
|
|
272
|
+
$[18] = t11;
|
|
268
273
|
} else {
|
|
269
|
-
|
|
274
|
+
t11 = $[18];
|
|
270
275
|
}
|
|
271
|
-
let
|
|
272
|
-
if ($[
|
|
273
|
-
|
|
276
|
+
let t12;
|
|
277
|
+
if ($[19] !== ariaLabel || $[20] !== childRegistry || $[21] !== groupedItems || $[22] !== menuItemIds) {
|
|
278
|
+
t12 = menuItemIds.size > 0 && /*#__PURE__*/jsxs(ActionMenu, {
|
|
274
279
|
children: [/*#__PURE__*/jsx(ActionMenu.Anchor, {
|
|
275
280
|
children: /*#__PURE__*/jsx(IconButton, {
|
|
276
281
|
variant: "invisible",
|
|
@@ -279,13 +284,13 @@ const ActionBar = props => {
|
|
|
279
284
|
})
|
|
280
285
|
}), /*#__PURE__*/jsx(ActionMenu.Overlay, {
|
|
281
286
|
children: /*#__PURE__*/jsx(ActionList, {
|
|
282
|
-
children: Array.from(menuItemIds).map(
|
|
283
|
-
const menuItem = childRegistry
|
|
287
|
+
children: Array.from(menuItemIds).map(id_2 => {
|
|
288
|
+
const menuItem = childRegistry.get(id_2);
|
|
284
289
|
if (!menuItem) {
|
|
285
290
|
return null;
|
|
286
291
|
}
|
|
287
292
|
if (menuItem.type === "divider") {
|
|
288
|
-
return /*#__PURE__*/jsx(ActionList.Divider, {},
|
|
293
|
+
return /*#__PURE__*/jsx(ActionList.Divider, {}, id_2);
|
|
289
294
|
} else {
|
|
290
295
|
if (menuItem.type === "action") {
|
|
291
296
|
const {
|
|
@@ -324,205 +329,292 @@ const ActionBar = props => {
|
|
|
324
329
|
returnFocusRef
|
|
325
330
|
}),
|
|
326
331
|
children: /*#__PURE__*/jsx(ActionList, {
|
|
327
|
-
children: menuItems.map(
|
|
332
|
+
children: menuItems.map(_temp3)
|
|
328
333
|
})
|
|
329
334
|
})]
|
|
330
|
-
},
|
|
335
|
+
}, id_2);
|
|
331
336
|
}
|
|
332
|
-
const groupedMenuItems = groupedItems.get(
|
|
337
|
+
const groupedMenuItems = groupedItems.get(id_2) || [];
|
|
333
338
|
if (menuItem.type === "group") {
|
|
334
339
|
return /*#__PURE__*/jsx(React.Fragment, {
|
|
335
|
-
children: groupedMenuItems.map(
|
|
336
|
-
},
|
|
340
|
+
children: groupedMenuItems.map(_temp4)
|
|
341
|
+
}, id_2);
|
|
337
342
|
}
|
|
338
343
|
})
|
|
339
344
|
})
|
|
340
345
|
})]
|
|
341
346
|
});
|
|
342
|
-
$[
|
|
343
|
-
$[
|
|
344
|
-
$[
|
|
345
|
-
$[
|
|
346
|
-
$[
|
|
347
|
+
$[19] = ariaLabel;
|
|
348
|
+
$[20] = childRegistry;
|
|
349
|
+
$[21] = groupedItems;
|
|
350
|
+
$[22] = menuItemIds;
|
|
351
|
+
$[23] = t12;
|
|
347
352
|
} else {
|
|
348
|
-
|
|
353
|
+
t12 = $[23];
|
|
349
354
|
}
|
|
350
|
-
let
|
|
351
|
-
if ($[
|
|
352
|
-
|
|
355
|
+
let t13;
|
|
356
|
+
if ($[24] !== ariaLabel || $[25] !== ariaLabelledBy || $[26] !== children || $[27] !== gap || $[28] !== t12) {
|
|
357
|
+
t13 = /*#__PURE__*/jsxs("div", {
|
|
353
358
|
ref: listRef,
|
|
354
359
|
role: "toolbar",
|
|
355
360
|
className: styles.List,
|
|
356
361
|
"aria-label": ariaLabel,
|
|
357
362
|
"aria-labelledby": ariaLabelledBy,
|
|
358
363
|
"data-gap": gap,
|
|
359
|
-
children: [
|
|
364
|
+
children: [children, t12]
|
|
360
365
|
});
|
|
361
|
-
$[
|
|
362
|
-
$[
|
|
366
|
+
$[24] = ariaLabel;
|
|
367
|
+
$[25] = ariaLabelledBy;
|
|
368
|
+
$[26] = children;
|
|
363
369
|
$[27] = gap;
|
|
364
|
-
$[28] =
|
|
365
|
-
$[29] =
|
|
366
|
-
$[30] = t12;
|
|
370
|
+
$[28] = t12;
|
|
371
|
+
$[29] = t13;
|
|
367
372
|
} else {
|
|
368
|
-
|
|
373
|
+
t13 = $[29];
|
|
369
374
|
}
|
|
370
|
-
let
|
|
371
|
-
if ($[
|
|
372
|
-
|
|
375
|
+
let t14;
|
|
376
|
+
if ($[30] !== flush || $[31] !== t11 || $[32] !== t13) {
|
|
377
|
+
t14 = /*#__PURE__*/jsx("div", {
|
|
373
378
|
ref: navRef,
|
|
374
|
-
className:
|
|
379
|
+
className: t11,
|
|
375
380
|
"data-flush": flush,
|
|
376
|
-
children:
|
|
381
|
+
children: t13
|
|
377
382
|
});
|
|
378
|
-
$[
|
|
379
|
-
$[
|
|
380
|
-
$[
|
|
381
|
-
$[
|
|
383
|
+
$[30] = flush;
|
|
384
|
+
$[31] = t11;
|
|
385
|
+
$[32] = t13;
|
|
386
|
+
$[33] = t14;
|
|
382
387
|
} else {
|
|
383
|
-
|
|
388
|
+
t14 = $[33];
|
|
384
389
|
}
|
|
385
|
-
let
|
|
386
|
-
if ($[
|
|
387
|
-
|
|
388
|
-
value:
|
|
389
|
-
children:
|
|
390
|
+
let t15;
|
|
391
|
+
if ($[34] !== t10 || $[35] !== t14) {
|
|
392
|
+
t15 = /*#__PURE__*/jsx(ActionBarContext.Provider, {
|
|
393
|
+
value: t10,
|
|
394
|
+
children: t14
|
|
390
395
|
});
|
|
391
|
-
$[
|
|
392
|
-
$[
|
|
393
|
-
$[
|
|
396
|
+
$[34] = t10;
|
|
397
|
+
$[35] = t14;
|
|
398
|
+
$[36] = t15;
|
|
394
399
|
} else {
|
|
395
|
-
|
|
400
|
+
t15 = $[36];
|
|
396
401
|
}
|
|
397
|
-
return
|
|
402
|
+
return t15;
|
|
398
403
|
};
|
|
399
|
-
|
|
400
|
-
const $ = c(
|
|
401
|
-
|
|
402
|
-
let
|
|
403
|
-
let
|
|
404
|
-
if ($[0] !==
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
$[0] =
|
|
411
|
-
$[1] =
|
|
412
|
-
$[2] =
|
|
404
|
+
const ActionBarIconButton = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
405
|
+
const $ = c(27);
|
|
406
|
+
let disabled;
|
|
407
|
+
let onClick;
|
|
408
|
+
let props;
|
|
409
|
+
if ($[0] !== t0) {
|
|
410
|
+
({
|
|
411
|
+
disabled,
|
|
412
|
+
onClick,
|
|
413
|
+
...props
|
|
414
|
+
} = t0);
|
|
415
|
+
$[0] = t0;
|
|
416
|
+
$[1] = disabled;
|
|
417
|
+
$[2] = onClick;
|
|
418
|
+
$[3] = props;
|
|
413
419
|
} else {
|
|
414
|
-
|
|
415
|
-
|
|
420
|
+
disabled = $[1];
|
|
421
|
+
onClick = $[2];
|
|
422
|
+
props = $[3];
|
|
416
423
|
}
|
|
417
|
-
useIsomorphicLayoutEffect(t0, t1);
|
|
418
|
-
return width;
|
|
419
|
-
}
|
|
420
|
-
const ActionBarIconButton = /*#__PURE__*/forwardRef(({
|
|
421
|
-
disabled,
|
|
422
|
-
onClick,
|
|
423
|
-
...props
|
|
424
|
-
}, forwardedRef) => {
|
|
425
424
|
const ref = useRef(null);
|
|
426
425
|
useRefObjectAsForwardedRef(forwardedRef, ref);
|
|
426
|
+
const id = useId();
|
|
427
427
|
const {
|
|
428
428
|
size,
|
|
429
|
+
registerChild,
|
|
430
|
+
unregisterChild,
|
|
429
431
|
isVisibleChild
|
|
430
432
|
} = React.useContext(ActionBarContext);
|
|
431
433
|
const {
|
|
432
434
|
groupId
|
|
433
435
|
} = React.useContext(ActionBarGroupContext);
|
|
434
|
-
const
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
436
|
+
const widthRef = useRef();
|
|
437
|
+
let t1;
|
|
438
|
+
if ($[4] !== disabled || $[5] !== groupId || $[6] !== id || $[7] !== onClick || $[8] !== props || $[9] !== registerChild || $[10] !== unregisterChild) {
|
|
439
|
+
t1 = () => {
|
|
440
|
+
var _ref$current, _props$ariaLabel;
|
|
441
|
+
const width = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.getBoundingClientRect().width;
|
|
442
|
+
if (width) {
|
|
443
|
+
widthRef.current = width;
|
|
444
|
+
}
|
|
445
|
+
if (!widthRef.current) {
|
|
446
|
+
return;
|
|
447
|
+
}
|
|
448
|
+
registerChild(id, {
|
|
449
|
+
type: "action",
|
|
450
|
+
label: (_props$ariaLabel = props["aria-label"]) !== null && _props$ariaLabel !== void 0 ? _props$ariaLabel : "",
|
|
451
|
+
icon: props.icon,
|
|
452
|
+
disabled: !!disabled,
|
|
453
|
+
onClick: onClick,
|
|
454
|
+
width: widthRef.current,
|
|
455
|
+
groupId: groupId !== null && groupId !== void 0 ? groupId : undefined
|
|
456
|
+
});
|
|
457
|
+
return () => {
|
|
458
|
+
unregisterChild(id);
|
|
459
|
+
};
|
|
460
|
+
};
|
|
461
|
+
$[4] = disabled;
|
|
462
|
+
$[5] = groupId;
|
|
463
|
+
$[6] = id;
|
|
464
|
+
$[7] = onClick;
|
|
465
|
+
$[8] = props;
|
|
466
|
+
$[9] = registerChild;
|
|
467
|
+
$[10] = unregisterChild;
|
|
468
|
+
$[11] = t1;
|
|
469
|
+
} else {
|
|
470
|
+
t1 = $[11];
|
|
471
|
+
}
|
|
472
|
+
const t2 = props["aria-label"];
|
|
473
|
+
let t3;
|
|
474
|
+
if ($[12] !== disabled || $[13] !== onClick || $[14] !== props.icon || $[15] !== registerChild || $[16] !== t2 || $[17] !== unregisterChild) {
|
|
475
|
+
t3 = [registerChild, unregisterChild, t2, props.icon, disabled, onClick];
|
|
476
|
+
$[12] = disabled;
|
|
477
|
+
$[13] = onClick;
|
|
478
|
+
$[14] = props.icon;
|
|
479
|
+
$[15] = registerChild;
|
|
480
|
+
$[16] = t2;
|
|
481
|
+
$[17] = unregisterChild;
|
|
482
|
+
$[18] = t3;
|
|
483
|
+
} else {
|
|
484
|
+
t3 = $[18];
|
|
485
|
+
}
|
|
486
|
+
useIsomorphicLayoutEffect(t1, t3);
|
|
487
|
+
let t4;
|
|
488
|
+
if ($[19] !== disabled || $[20] !== onClick) {
|
|
489
|
+
t4 = event => {
|
|
490
|
+
var _onClick;
|
|
491
|
+
if (disabled) {
|
|
492
|
+
return;
|
|
493
|
+
}
|
|
494
|
+
(_onClick = onClick) === null || _onClick === void 0 ? void 0 : _onClick(event);
|
|
495
|
+
};
|
|
496
|
+
$[19] = disabled;
|
|
497
|
+
$[20] = onClick;
|
|
498
|
+
$[21] = t4;
|
|
499
|
+
} else {
|
|
500
|
+
t4 = $[21];
|
|
501
|
+
}
|
|
502
|
+
const clickHandler = t4;
|
|
503
|
+
if (!isVisibleChild(id) || groupId && !isVisibleChild(groupId)) {
|
|
504
|
+
return null;
|
|
505
|
+
}
|
|
506
|
+
let t5;
|
|
507
|
+
if ($[22] !== clickHandler || $[23] !== disabled || $[24] !== props || $[25] !== size) {
|
|
508
|
+
t5 = /*#__PURE__*/jsx(IconButton, {
|
|
509
|
+
"aria-disabled": disabled,
|
|
510
|
+
ref: ref,
|
|
511
|
+
size: size,
|
|
512
|
+
onClick: clickHandler,
|
|
513
|
+
...props,
|
|
514
|
+
variant: "invisible"
|
|
515
|
+
});
|
|
516
|
+
$[22] = clickHandler;
|
|
517
|
+
$[23] = disabled;
|
|
518
|
+
$[24] = props;
|
|
519
|
+
$[25] = size;
|
|
520
|
+
$[26] = t5;
|
|
521
|
+
} else {
|
|
522
|
+
t5 = $[26];
|
|
523
|
+
}
|
|
524
|
+
return t5;
|
|
462
525
|
});
|
|
463
526
|
const ActionBarGroupContext = /*#__PURE__*/React.createContext({
|
|
464
527
|
groupId: null
|
|
465
528
|
});
|
|
466
529
|
const ActionBarGroup = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
467
|
-
const $ = c(
|
|
530
|
+
const $ = c(16);
|
|
468
531
|
const {
|
|
469
532
|
children
|
|
470
533
|
} = t0;
|
|
471
534
|
const backupRef = useRef(null);
|
|
472
535
|
const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
473
|
-
const
|
|
536
|
+
const id = useId();
|
|
537
|
+
const {
|
|
538
|
+
registerChild,
|
|
539
|
+
unregisterChild
|
|
540
|
+
} = React.useContext(ActionBarContext);
|
|
541
|
+
const widthRef = useRef();
|
|
474
542
|
let t1;
|
|
475
|
-
if ($[0] !==
|
|
476
|
-
t1 = {
|
|
477
|
-
|
|
478
|
-
width
|
|
543
|
+
if ($[0] !== id || $[1] !== ref || $[2] !== registerChild || $[3] !== unregisterChild) {
|
|
544
|
+
t1 = () => {
|
|
545
|
+
var _ref$current2;
|
|
546
|
+
const width = (_ref$current2 = ref.current) === null || _ref$current2 === void 0 ? void 0 : _ref$current2.getBoundingClientRect().width;
|
|
547
|
+
if (width) {
|
|
548
|
+
widthRef.current = width;
|
|
549
|
+
}
|
|
550
|
+
if (!widthRef.current) {
|
|
551
|
+
return;
|
|
552
|
+
}
|
|
553
|
+
registerChild(id, {
|
|
554
|
+
type: "group",
|
|
555
|
+
width: widthRef.current
|
|
556
|
+
});
|
|
557
|
+
return () => {
|
|
558
|
+
unregisterChild(id);
|
|
559
|
+
};
|
|
479
560
|
};
|
|
480
|
-
$[0] =
|
|
481
|
-
$[1] =
|
|
561
|
+
$[0] = id;
|
|
562
|
+
$[1] = ref;
|
|
563
|
+
$[2] = registerChild;
|
|
564
|
+
$[3] = unregisterChild;
|
|
565
|
+
$[4] = t1;
|
|
482
566
|
} else {
|
|
483
|
-
t1 = $[
|
|
567
|
+
t1 = $[4];
|
|
484
568
|
}
|
|
485
|
-
const registryProps = t1;
|
|
486
|
-
const id = ActionBarItemsRegistry.useRegisterDescendant(registryProps);
|
|
487
569
|
let t2;
|
|
488
|
-
if ($[
|
|
489
|
-
t2 =
|
|
570
|
+
if ($[5] !== registerChild || $[6] !== unregisterChild) {
|
|
571
|
+
t2 = [registerChild, unregisterChild];
|
|
572
|
+
$[5] = registerChild;
|
|
573
|
+
$[6] = unregisterChild;
|
|
574
|
+
$[7] = t2;
|
|
575
|
+
} else {
|
|
576
|
+
t2 = $[7];
|
|
577
|
+
}
|
|
578
|
+
useIsomorphicLayoutEffect(t1, t2);
|
|
579
|
+
let t3;
|
|
580
|
+
if ($[8] !== id) {
|
|
581
|
+
t3 = {
|
|
490
582
|
groupId: id
|
|
491
583
|
};
|
|
492
|
-
$[
|
|
493
|
-
$[
|
|
584
|
+
$[8] = id;
|
|
585
|
+
$[9] = t3;
|
|
494
586
|
} else {
|
|
495
|
-
|
|
587
|
+
t3 = $[9];
|
|
496
588
|
}
|
|
497
|
-
let
|
|
498
|
-
if ($[
|
|
499
|
-
|
|
589
|
+
let t4;
|
|
590
|
+
if ($[10] !== children || $[11] !== ref) {
|
|
591
|
+
t4 = /*#__PURE__*/jsx("div", {
|
|
500
592
|
className: styles.Group,
|
|
501
593
|
ref: ref,
|
|
502
594
|
children: children
|
|
503
595
|
});
|
|
504
|
-
$[
|
|
505
|
-
$[
|
|
506
|
-
$[
|
|
596
|
+
$[10] = children;
|
|
597
|
+
$[11] = ref;
|
|
598
|
+
$[12] = t4;
|
|
507
599
|
} else {
|
|
508
|
-
|
|
600
|
+
t4 = $[12];
|
|
509
601
|
}
|
|
510
|
-
let
|
|
511
|
-
if ($[
|
|
512
|
-
|
|
513
|
-
value:
|
|
514
|
-
children:
|
|
602
|
+
let t5;
|
|
603
|
+
if ($[13] !== t3 || $[14] !== t4) {
|
|
604
|
+
t5 = /*#__PURE__*/jsx(ActionBarGroupContext.Provider, {
|
|
605
|
+
value: t3,
|
|
606
|
+
children: t4
|
|
515
607
|
});
|
|
516
|
-
$[
|
|
517
|
-
$[
|
|
518
|
-
$[
|
|
608
|
+
$[13] = t3;
|
|
609
|
+
$[14] = t4;
|
|
610
|
+
$[15] = t5;
|
|
519
611
|
} else {
|
|
520
|
-
|
|
612
|
+
t5 = $[15];
|
|
521
613
|
}
|
|
522
|
-
return
|
|
614
|
+
return t5;
|
|
523
615
|
});
|
|
524
616
|
const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
525
|
-
const $ = c(
|
|
617
|
+
const $ = c(42);
|
|
526
618
|
let ariaLabel;
|
|
527
619
|
let icon;
|
|
528
620
|
let items;
|
|
@@ -555,38 +647,69 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
555
647
|
}
|
|
556
648
|
const backupRef = useRef(null);
|
|
557
649
|
const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
650
|
+
const id = useId();
|
|
558
651
|
const {
|
|
652
|
+
registerChild,
|
|
653
|
+
unregisterChild,
|
|
559
654
|
isVisibleChild
|
|
560
655
|
} = React.useContext(ActionBarContext);
|
|
561
656
|
const [menuOpen, setMenuOpen] = useState(false);
|
|
562
|
-
const
|
|
563
|
-
|
|
564
|
-
|
|
565
|
-
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
width
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
657
|
+
const widthRef = useRef();
|
|
658
|
+
let t1;
|
|
659
|
+
if ($[7] !== ariaLabel || $[8] !== icon || $[9] !== id || $[10] !== items || $[11] !== overflowIcon || $[12] !== ref || $[13] !== registerChild || $[14] !== returnFocusRef || $[15] !== unregisterChild) {
|
|
660
|
+
t1 = () => {
|
|
661
|
+
var _ref$current3;
|
|
662
|
+
const width = (_ref$current3 = ref.current) === null || _ref$current3 === void 0 ? void 0 : _ref$current3.getBoundingClientRect().width;
|
|
663
|
+
if (width) {
|
|
664
|
+
widthRef.current = width;
|
|
665
|
+
}
|
|
666
|
+
if (!widthRef.current) {
|
|
667
|
+
return;
|
|
668
|
+
}
|
|
669
|
+
registerChild(id, {
|
|
670
|
+
type: "menu",
|
|
671
|
+
width: widthRef.current,
|
|
672
|
+
label: ariaLabel,
|
|
673
|
+
icon: overflowIcon ? overflowIcon : icon,
|
|
674
|
+
returnFocusRef,
|
|
675
|
+
items
|
|
676
|
+
});
|
|
677
|
+
return () => {
|
|
678
|
+
unregisterChild(id);
|
|
679
|
+
};
|
|
573
680
|
};
|
|
574
681
|
$[7] = ariaLabel;
|
|
575
|
-
$[8] =
|
|
576
|
-
$[9] =
|
|
577
|
-
$[10] =
|
|
578
|
-
$[11] =
|
|
579
|
-
$[12] =
|
|
682
|
+
$[8] = icon;
|
|
683
|
+
$[9] = id;
|
|
684
|
+
$[10] = items;
|
|
685
|
+
$[11] = overflowIcon;
|
|
686
|
+
$[12] = ref;
|
|
687
|
+
$[13] = registerChild;
|
|
688
|
+
$[14] = returnFocusRef;
|
|
689
|
+
$[15] = unregisterChild;
|
|
690
|
+
$[16] = t1;
|
|
691
|
+
} else {
|
|
692
|
+
t1 = $[16];
|
|
693
|
+
}
|
|
694
|
+
let t2;
|
|
695
|
+
if ($[17] !== ariaLabel || $[18] !== icon || $[19] !== items || $[20] !== overflowIcon || $[21] !== registerChild || $[22] !== unregisterChild) {
|
|
696
|
+
t2 = [registerChild, unregisterChild, ariaLabel, overflowIcon, icon, items];
|
|
697
|
+
$[17] = ariaLabel;
|
|
698
|
+
$[18] = icon;
|
|
699
|
+
$[19] = items;
|
|
700
|
+
$[20] = overflowIcon;
|
|
701
|
+
$[21] = registerChild;
|
|
702
|
+
$[22] = unregisterChild;
|
|
703
|
+
$[23] = t2;
|
|
580
704
|
} else {
|
|
581
|
-
t2 = $[
|
|
705
|
+
t2 = $[23];
|
|
582
706
|
}
|
|
583
|
-
|
|
584
|
-
const id = ActionBarItemsRegistry.useRegisterDescendant(registryProps);
|
|
707
|
+
useIsomorphicLayoutEffect(t1, t2);
|
|
585
708
|
if (!isVisibleChild(id)) {
|
|
586
709
|
return null;
|
|
587
710
|
}
|
|
588
711
|
let t3;
|
|
589
|
-
if ($[
|
|
712
|
+
if ($[24] !== ariaLabel || $[25] !== icon || $[26] !== props) {
|
|
590
713
|
t3 = /*#__PURE__*/jsx(ActionMenu.Anchor, {
|
|
591
714
|
children: /*#__PURE__*/jsx(IconButton, {
|
|
592
715
|
variant: "invisible",
|
|
@@ -595,123 +718,150 @@ const ActionBarMenu = /*#__PURE__*/forwardRef((t0, forwardedRef) => {
|
|
|
595
718
|
...props
|
|
596
719
|
})
|
|
597
720
|
});
|
|
598
|
-
$[
|
|
599
|
-
$[
|
|
600
|
-
$[
|
|
601
|
-
$[
|
|
721
|
+
$[24] = ariaLabel;
|
|
722
|
+
$[25] = icon;
|
|
723
|
+
$[26] = props;
|
|
724
|
+
$[27] = t3;
|
|
602
725
|
} else {
|
|
603
|
-
t3 = $[
|
|
726
|
+
t3 = $[27];
|
|
604
727
|
}
|
|
605
728
|
let t4;
|
|
606
|
-
if ($[
|
|
729
|
+
if ($[28] !== returnFocusRef) {
|
|
607
730
|
t4 = returnFocusRef && {
|
|
608
731
|
returnFocusRef
|
|
609
732
|
};
|
|
610
|
-
$[
|
|
611
|
-
$[
|
|
733
|
+
$[28] = returnFocusRef;
|
|
734
|
+
$[29] = t4;
|
|
612
735
|
} else {
|
|
613
|
-
t4 = $[
|
|
736
|
+
t4 = $[29];
|
|
614
737
|
}
|
|
615
738
|
let t5;
|
|
616
|
-
if ($[
|
|
617
|
-
t5 = items.map(
|
|
618
|
-
$[
|
|
619
|
-
$[
|
|
739
|
+
if ($[30] !== items) {
|
|
740
|
+
t5 = items.map(_temp5);
|
|
741
|
+
$[30] = items;
|
|
742
|
+
$[31] = t5;
|
|
620
743
|
} else {
|
|
621
|
-
t5 = $[
|
|
744
|
+
t5 = $[31];
|
|
622
745
|
}
|
|
623
746
|
let t6;
|
|
624
|
-
if ($[
|
|
747
|
+
if ($[32] !== t5) {
|
|
625
748
|
t6 = /*#__PURE__*/jsx(ActionList, {
|
|
626
749
|
children: t5
|
|
627
750
|
});
|
|
628
|
-
$[
|
|
629
|
-
$[
|
|
751
|
+
$[32] = t5;
|
|
752
|
+
$[33] = t6;
|
|
630
753
|
} else {
|
|
631
|
-
t6 = $[
|
|
754
|
+
t6 = $[33];
|
|
632
755
|
}
|
|
633
756
|
let t7;
|
|
634
|
-
if ($[
|
|
757
|
+
if ($[34] !== t4 || $[35] !== t6) {
|
|
635
758
|
t7 = /*#__PURE__*/jsx(ActionMenu.Overlay, {
|
|
636
759
|
...t4,
|
|
637
760
|
children: t6
|
|
638
761
|
});
|
|
639
|
-
$[
|
|
640
|
-
$[
|
|
641
|
-
$[
|
|
762
|
+
$[34] = t4;
|
|
763
|
+
$[35] = t6;
|
|
764
|
+
$[36] = t7;
|
|
642
765
|
} else {
|
|
643
|
-
t7 = $[
|
|
766
|
+
t7 = $[36];
|
|
644
767
|
}
|
|
645
768
|
let t8;
|
|
646
|
-
if ($[
|
|
769
|
+
if ($[37] !== menuOpen || $[38] !== ref || $[39] !== t3 || $[40] !== t7) {
|
|
647
770
|
t8 = /*#__PURE__*/jsxs(ActionMenu, {
|
|
648
771
|
anchorRef: ref,
|
|
649
772
|
open: menuOpen,
|
|
650
773
|
onOpenChange: setMenuOpen,
|
|
651
774
|
children: [t3, t7]
|
|
652
775
|
});
|
|
653
|
-
$[
|
|
654
|
-
$[
|
|
655
|
-
$[
|
|
656
|
-
$[
|
|
657
|
-
$[
|
|
776
|
+
$[37] = menuOpen;
|
|
777
|
+
$[38] = ref;
|
|
778
|
+
$[39] = t3;
|
|
779
|
+
$[40] = t7;
|
|
780
|
+
$[41] = t8;
|
|
658
781
|
} else {
|
|
659
|
-
t8 = $[
|
|
782
|
+
t8 = $[41];
|
|
660
783
|
}
|
|
661
784
|
return t8;
|
|
662
785
|
});
|
|
663
786
|
const VerticalDivider = () => {
|
|
664
|
-
const $ = c(
|
|
787
|
+
const $ = c(8);
|
|
665
788
|
const ref = useRef(null);
|
|
789
|
+
const id = useId();
|
|
666
790
|
const {
|
|
791
|
+
registerChild,
|
|
792
|
+
unregisterChild,
|
|
667
793
|
isVisibleChild
|
|
668
794
|
} = React.useContext(ActionBarContext);
|
|
669
|
-
const
|
|
795
|
+
const widthRef = useRef();
|
|
670
796
|
let t0;
|
|
671
|
-
if ($[0] !==
|
|
672
|
-
t0 = {
|
|
673
|
-
|
|
674
|
-
width
|
|
797
|
+
if ($[0] !== id || $[1] !== registerChild || $[2] !== unregisterChild) {
|
|
798
|
+
t0 = () => {
|
|
799
|
+
var _ref$current4;
|
|
800
|
+
const width = (_ref$current4 = ref.current) === null || _ref$current4 === void 0 ? void 0 : _ref$current4.getBoundingClientRect().width;
|
|
801
|
+
if (width) {
|
|
802
|
+
widthRef.current = width;
|
|
803
|
+
}
|
|
804
|
+
if (!widthRef.current) {
|
|
805
|
+
return;
|
|
806
|
+
}
|
|
807
|
+
registerChild(id, {
|
|
808
|
+
type: "divider",
|
|
809
|
+
width: widthRef.current
|
|
810
|
+
});
|
|
811
|
+
return () => unregisterChild(id);
|
|
675
812
|
};
|
|
676
|
-
$[0] =
|
|
677
|
-
$[1] =
|
|
813
|
+
$[0] = id;
|
|
814
|
+
$[1] = registerChild;
|
|
815
|
+
$[2] = unregisterChild;
|
|
816
|
+
$[3] = t0;
|
|
817
|
+
} else {
|
|
818
|
+
t0 = $[3];
|
|
819
|
+
}
|
|
820
|
+
let t1;
|
|
821
|
+
if ($[4] !== registerChild || $[5] !== unregisterChild) {
|
|
822
|
+
t1 = [registerChild, unregisterChild];
|
|
823
|
+
$[4] = registerChild;
|
|
824
|
+
$[5] = unregisterChild;
|
|
825
|
+
$[6] = t1;
|
|
678
826
|
} else {
|
|
679
|
-
|
|
827
|
+
t1 = $[6];
|
|
680
828
|
}
|
|
681
|
-
|
|
682
|
-
const id = ActionBarItemsRegistry.useRegisterDescendant(registryProps);
|
|
829
|
+
useIsomorphicLayoutEffect(t0, t1);
|
|
683
830
|
if (!isVisibleChild(id)) {
|
|
684
831
|
return null;
|
|
685
832
|
}
|
|
686
|
-
let
|
|
687
|
-
if ($[
|
|
688
|
-
|
|
833
|
+
let t2;
|
|
834
|
+
if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
|
|
835
|
+
t2 = /*#__PURE__*/jsx("div", {
|
|
689
836
|
ref: ref,
|
|
690
837
|
"data-component": "ActionBar.VerticalDivider",
|
|
691
838
|
"aria-hidden": "true",
|
|
692
839
|
className: styles.Divider
|
|
693
840
|
});
|
|
694
|
-
$[
|
|
841
|
+
$[7] = t2;
|
|
695
842
|
} else {
|
|
696
|
-
|
|
843
|
+
t2 = $[7];
|
|
697
844
|
}
|
|
698
|
-
return
|
|
845
|
+
return t2;
|
|
699
846
|
};
|
|
700
847
|
function _temp() {
|
|
848
|
+
return new Map();
|
|
849
|
+
}
|
|
850
|
+
function _temp2() {
|
|
701
851
|
return new Set();
|
|
702
852
|
}
|
|
703
|
-
function
|
|
853
|
+
function _temp3(item, index) {
|
|
704
854
|
return renderMenuItem(item, index);
|
|
705
855
|
}
|
|
706
|
-
function
|
|
707
|
-
const [key_0,
|
|
708
|
-
if (
|
|
856
|
+
function _temp4(t0) {
|
|
857
|
+
const [key_0, childProps_1] = t0;
|
|
858
|
+
if (childProps_1.type === "action") {
|
|
709
859
|
const {
|
|
710
860
|
onClick: onClick_0,
|
|
711
861
|
icon: Icon_1,
|
|
712
862
|
label: label_1,
|
|
713
863
|
disabled: disabled_0
|
|
714
|
-
} =
|
|
864
|
+
} = childProps_1;
|
|
715
865
|
return /*#__PURE__*/jsxs(ActionList.Item, {
|
|
716
866
|
onSelect: event_0 => {
|
|
717
867
|
typeof onClick_0 === "function" && onClick_0(event_0);
|
|
@@ -724,7 +874,7 @@ function _temp3(t0) {
|
|
|
724
874
|
}
|
|
725
875
|
return null;
|
|
726
876
|
}
|
|
727
|
-
function
|
|
877
|
+
function _temp5(item, index) {
|
|
728
878
|
return renderMenuItem(item, index);
|
|
729
879
|
}
|
|
730
880
|
|
package/package.json
CHANGED
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import { type Dispatch, type ReactNode } from 'react';
|
|
2
|
-
export interface ProviderProps<T> {
|
|
3
|
-
children: ReactNode;
|
|
4
|
-
/** State setter from `useRegistryState`. */
|
|
5
|
-
setRegistry: Dispatch<React.SetStateAction<ReadonlyMap<string, T> | undefined>>;
|
|
6
|
-
}
|
|
7
|
-
/**
|
|
8
|
-
* Create a "descendant registry" for a component. This allows a parent to store and track an ordered registry of
|
|
9
|
-
* child components, even if they are deeply nested in the tree. For example, a menu component can use this to track
|
|
10
|
-
* every menu item inside of it, including menu items inside of fragments and subcomponents. The order of the resulting
|
|
11
|
-
* `Map` will match the render order in the React tree.
|
|
12
|
-
*
|
|
13
|
-
* Usage:
|
|
14
|
-
* 1. Create a registry at the file level in a similar manner to creating a new React context. Set `T` to the data type
|
|
15
|
-
* of the registry - this can be anything **except** a function.
|
|
16
|
-
* 2. In the parent component, instantiate the registry state via `useRegistryState`. Then wrap `children` in the
|
|
17
|
-
* registry context `Provider` with `setRegistry` set to the state setter function.
|
|
18
|
-
* 3. Register child components via `useRegisterDescendant` or `useRegisterDescendantCallback`.
|
|
19
|
-
* 4. Access the registered data using the value from `useRegistryState`. This will be a map of `string` to `T`, where
|
|
20
|
-
* the string key is a unique and stable identifier for each component which can be used as a `key` if necessary.
|
|
21
|
-
*
|
|
22
|
-
* @note Note that this pattern is not SSR compatible. It won't raise errors or hydration mismatches, but the
|
|
23
|
-
* registry will not be available during SSR. The registry is built during the effect phase, so it will be populated
|
|
24
|
-
* after hydration on the client. The initial `undefined` value can be used to safely show loading UI during SSR/initial
|
|
25
|
-
* render if necessary.
|
|
26
|
-
*/
|
|
27
|
-
export declare function createDescendantRegistry<T>(): {
|
|
28
|
-
Provider: ({ children, setRegistry }: ProviderProps<T>) => import("react").JSX.Element;
|
|
29
|
-
useRegistryState: () => [ReadonlyMap<string, T> | undefined, Dispatch<import("react").SetStateAction<ReadonlyMap<string, T> | undefined>>];
|
|
30
|
-
useRegisterDescendant: (value: T) => string;
|
|
31
|
-
};
|
|
32
|
-
//# sourceMappingURL=descendant-registry.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"descendant-registry.d.ts","sourceRoot":"","sources":["../../src/utils/descendant-registry.tsx"],"names":[],"mappings":"AAAA,OAAO,EAUL,KAAK,QAAQ,EACb,KAAK,SAAS,EACf,MAAM,OAAO,CAAA;AAGd,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,QAAQ,EAAE,SAAS,CAAA;IACnB,4CAA4C;IAC5C,WAAW,EAAE,QAAQ,CAAC,KAAK,CAAC,cAAc,CAAC,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS,CAAC,CAAC,CAAA;CAChF;AAQD;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,wBAAwB,CAAC,CAAC;0CAgCG,aAAa,CAAC,CAAC,CAAC;;mCAfrB,CAAC;EA8FxC"}
|
|
@@ -1,222 +0,0 @@
|
|
|
1
|
-
import { c } from 'react-compiler-runtime';
|
|
2
|
-
import { useContext, useId, useEffect, useState, useRef, useReducer, createContext } from 'react';
|
|
3
|
-
import useIsomorphicLayoutEffect from './useIsomorphicLayoutEffect.js';
|
|
4
|
-
import { jsx } from 'react/jsx-runtime';
|
|
5
|
-
|
|
6
|
-
/**
|
|
7
|
-
* Create a "descendant registry" for a component. This allows a parent to store and track an ordered registry of
|
|
8
|
-
* child components, even if they are deeply nested in the tree. For example, a menu component can use this to track
|
|
9
|
-
* every menu item inside of it, including menu items inside of fragments and subcomponents. The order of the resulting
|
|
10
|
-
* `Map` will match the render order in the React tree.
|
|
11
|
-
*
|
|
12
|
-
* Usage:
|
|
13
|
-
* 1. Create a registry at the file level in a similar manner to creating a new React context. Set `T` to the data type
|
|
14
|
-
* of the registry - this can be anything **except** a function.
|
|
15
|
-
* 2. In the parent component, instantiate the registry state via `useRegistryState`. Then wrap `children` in the
|
|
16
|
-
* registry context `Provider` with `setRegistry` set to the state setter function.
|
|
17
|
-
* 3. Register child components via `useRegisterDescendant` or `useRegisterDescendantCallback`.
|
|
18
|
-
* 4. Access the registered data using the value from `useRegistryState`. This will be a map of `string` to `T`, where
|
|
19
|
-
* the string key is a unique and stable identifier for each component which can be used as a `key` if necessary.
|
|
20
|
-
*
|
|
21
|
-
* @note Note that this pattern is not SSR compatible. It won't raise errors or hydration mismatches, but the
|
|
22
|
-
* registry will not be available during SSR. The registry is built during the effect phase, so it will be populated
|
|
23
|
-
* after hydration on the client. The initial `undefined` value can be used to safely show loading UI during SSR/initial
|
|
24
|
-
* render if necessary.
|
|
25
|
-
*/
|
|
26
|
-
function createDescendantRegistry() {
|
|
27
|
-
const Context = /*#__PURE__*/createContext({
|
|
28
|
-
register: () => () => {},
|
|
29
|
-
updateValue: () => {},
|
|
30
|
-
key: -1
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
/**
|
|
34
|
-
* Instantiate descendant registry state. The initial value will be `undefined`, indicating that the registry hasn't
|
|
35
|
-
* been built yet.
|
|
36
|
-
*/
|
|
37
|
-
function useRegistryState() {
|
|
38
|
-
return useState();
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
/** Register a descendant component with the registry. */
|
|
42
|
-
function useRegisterDescendant(value) {
|
|
43
|
-
const $ = c(16);
|
|
44
|
-
const {
|
|
45
|
-
register,
|
|
46
|
-
updateValue,
|
|
47
|
-
key
|
|
48
|
-
} = useContext(Context);
|
|
49
|
-
const id = useId();
|
|
50
|
-
let t0;
|
|
51
|
-
if ($[0] !== id || $[1] !== register) {
|
|
52
|
-
t0 = () => register(id);
|
|
53
|
-
$[0] = id;
|
|
54
|
-
$[1] = register;
|
|
55
|
-
$[2] = t0;
|
|
56
|
-
} else {
|
|
57
|
-
t0 = $[2];
|
|
58
|
-
}
|
|
59
|
-
let t1;
|
|
60
|
-
if ($[3] !== id || $[4] !== key || $[5] !== register) {
|
|
61
|
-
t1 = [register, id, key];
|
|
62
|
-
$[3] = id;
|
|
63
|
-
$[4] = key;
|
|
64
|
-
$[5] = register;
|
|
65
|
-
$[6] = t1;
|
|
66
|
-
} else {
|
|
67
|
-
t1 = $[6];
|
|
68
|
-
}
|
|
69
|
-
useEffect(t0, t1);
|
|
70
|
-
let t2;
|
|
71
|
-
if ($[7] !== id || $[8] !== updateValue || $[9] !== value) {
|
|
72
|
-
t2 = () => updateValue(id, value);
|
|
73
|
-
$[7] = id;
|
|
74
|
-
$[8] = updateValue;
|
|
75
|
-
$[9] = value;
|
|
76
|
-
$[10] = t2;
|
|
77
|
-
} else {
|
|
78
|
-
t2 = $[10];
|
|
79
|
-
}
|
|
80
|
-
let t3;
|
|
81
|
-
if ($[11] !== id || $[12] !== key || $[13] !== updateValue || $[14] !== value) {
|
|
82
|
-
t3 = [updateValue, id, value, key];
|
|
83
|
-
$[11] = id;
|
|
84
|
-
$[12] = key;
|
|
85
|
-
$[13] = updateValue;
|
|
86
|
-
$[14] = value;
|
|
87
|
-
$[15] = t3;
|
|
88
|
-
} else {
|
|
89
|
-
t3 = $[15];
|
|
90
|
-
}
|
|
91
|
-
useEffect(t2, t3);
|
|
92
|
-
return id;
|
|
93
|
-
}
|
|
94
|
-
const unsetValue = Symbol('unset');
|
|
95
|
-
|
|
96
|
-
/** Provide context for registering descendant components. This only needs to wrap `children`. */
|
|
97
|
-
function Provider(t0) {
|
|
98
|
-
const $ = c(14);
|
|
99
|
-
const {
|
|
100
|
-
children,
|
|
101
|
-
setRegistry
|
|
102
|
-
} = t0;
|
|
103
|
-
const workingRegistryRef = useRef("queued");
|
|
104
|
-
const [key, rebuildRegistry] = useReducer(_temp, 0);
|
|
105
|
-
let t1;
|
|
106
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
107
|
-
t1 = function instantiateNewRegistry() {
|
|
108
|
-
if (workingRegistryRef.current === "queued") {
|
|
109
|
-
workingRegistryRef.current = new Map();
|
|
110
|
-
}
|
|
111
|
-
};
|
|
112
|
-
$[0] = t1;
|
|
113
|
-
} else {
|
|
114
|
-
t1 = $[0];
|
|
115
|
-
}
|
|
116
|
-
useIsomorphicLayoutEffect(t1);
|
|
117
|
-
let t2;
|
|
118
|
-
if ($[1] !== setRegistry) {
|
|
119
|
-
t2 = id => {
|
|
120
|
-
if (workingRegistryRef.current instanceof Map) {
|
|
121
|
-
workingRegistryRef.current.set(id, unsetValue);
|
|
122
|
-
} else {
|
|
123
|
-
if (workingRegistryRef.current === "idle") {
|
|
124
|
-
workingRegistryRef.current = "queued";
|
|
125
|
-
rebuildRegistry();
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
return function unregister() {
|
|
129
|
-
if (workingRegistryRef.current instanceof Map) {
|
|
130
|
-
workingRegistryRef.current.delete(id);
|
|
131
|
-
} else {
|
|
132
|
-
if (workingRegistryRef.current === "idle") {
|
|
133
|
-
setRegistry(prev_0 => {
|
|
134
|
-
const copy = new Map(prev_0);
|
|
135
|
-
copy.delete(id);
|
|
136
|
-
return copy;
|
|
137
|
-
});
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
};
|
|
141
|
-
};
|
|
142
|
-
$[1] = setRegistry;
|
|
143
|
-
$[2] = t2;
|
|
144
|
-
} else {
|
|
145
|
-
t2 = $[2];
|
|
146
|
-
}
|
|
147
|
-
const register = t2;
|
|
148
|
-
let t3;
|
|
149
|
-
if ($[3] !== setRegistry) {
|
|
150
|
-
t3 = (id_0, value) => {
|
|
151
|
-
if (workingRegistryRef.current instanceof Map) {
|
|
152
|
-
workingRegistryRef.current.set(id_0, value);
|
|
153
|
-
} else {
|
|
154
|
-
if (workingRegistryRef.current === "idle") {
|
|
155
|
-
setRegistry(prev_1 => new Map(prev_1).set(id_0, value));
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
};
|
|
159
|
-
$[3] = setRegistry;
|
|
160
|
-
$[4] = t3;
|
|
161
|
-
} else {
|
|
162
|
-
t3 = $[4];
|
|
163
|
-
}
|
|
164
|
-
const updateValue = t3;
|
|
165
|
-
let t4;
|
|
166
|
-
if ($[5] !== setRegistry) {
|
|
167
|
-
t4 = function commitWorkingRegistry() {
|
|
168
|
-
if (workingRegistryRef.current instanceof Map) {
|
|
169
|
-
const setEntries = Array.from(workingRegistryRef.current.entries()).filter(_temp2);
|
|
170
|
-
setRegistry(new Map(setEntries));
|
|
171
|
-
workingRegistryRef.current = "idle";
|
|
172
|
-
}
|
|
173
|
-
};
|
|
174
|
-
$[5] = setRegistry;
|
|
175
|
-
$[6] = t4;
|
|
176
|
-
} else {
|
|
177
|
-
t4 = $[6];
|
|
178
|
-
}
|
|
179
|
-
useEffect(t4);
|
|
180
|
-
let t5;
|
|
181
|
-
if ($[7] !== key || $[8] !== register || $[9] !== updateValue) {
|
|
182
|
-
t5 = {
|
|
183
|
-
register,
|
|
184
|
-
updateValue,
|
|
185
|
-
key
|
|
186
|
-
};
|
|
187
|
-
$[7] = key;
|
|
188
|
-
$[8] = register;
|
|
189
|
-
$[9] = updateValue;
|
|
190
|
-
$[10] = t5;
|
|
191
|
-
} else {
|
|
192
|
-
t5 = $[10];
|
|
193
|
-
}
|
|
194
|
-
const contextValue = t5;
|
|
195
|
-
let t6;
|
|
196
|
-
if ($[11] !== children || $[12] !== contextValue) {
|
|
197
|
-
t6 = /*#__PURE__*/jsx(Context.Provider, {
|
|
198
|
-
value: contextValue,
|
|
199
|
-
children: children
|
|
200
|
-
});
|
|
201
|
-
$[11] = children;
|
|
202
|
-
$[12] = contextValue;
|
|
203
|
-
$[13] = t6;
|
|
204
|
-
} else {
|
|
205
|
-
t6 = $[13];
|
|
206
|
-
}
|
|
207
|
-
return t6;
|
|
208
|
-
}
|
|
209
|
-
function _temp2(entry) {
|
|
210
|
-
return entry[1] !== unsetValue;
|
|
211
|
-
}
|
|
212
|
-
function _temp(prev) {
|
|
213
|
-
return prev + 1;
|
|
214
|
-
}
|
|
215
|
-
return {
|
|
216
|
-
Provider,
|
|
217
|
-
useRegistryState,
|
|
218
|
-
useRegisterDescendant
|
|
219
|
-
};
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
export { createDescendantRegistry };
|