@primer/react 0.0.0-20260522194214 → 0.0.0-20260523120913
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 +13 -10
- package/dist/ActionList/index.d.ts +6 -6
- package/dist/ActionMenu/ActionMenu.d.ts.map +1 -1
- package/dist/ActionMenu/ActionMenu.js +1 -0
- package/dist/AnchoredOverlay/AnchoredOverlay-d483d670.css +2 -0
- package/dist/AnchoredOverlay/AnchoredOverlay-d483d670.css.map +1 -0
- package/dist/AnchoredOverlay/AnchoredOverlay.module.css.js +1 -1
- package/dist/CheckboxGroup/CheckboxGroup.js +1 -0
- package/dist/DataTable/index.js +1 -1
- package/dist/Dialog/Dialog.d.ts +1 -0
- package/dist/Dialog/Dialog.d.ts.map +1 -1
- package/dist/Dialog/Dialog.js +1 -0
- package/dist/FormControl/FormControl.d.ts +3 -3
- package/dist/NavList/NavList.d.ts +4 -4
- package/dist/NavList/NavList.d.ts.map +1 -1
- package/dist/NavList/NavList.js +6 -7
- package/dist/Overlay/{Overlay-95cfd3c7.css → Overlay-214d10dd.css} +2 -2
- package/dist/Overlay/Overlay-214d10dd.css.map +1 -0
- package/dist/Overlay/Overlay.module.css.js +1 -1
- package/dist/PageHeader/PageHeader.d.ts.map +1 -1
- package/dist/PageHeader/PageHeader.js +46 -50
- package/dist/PageLayout/PageLayout.d.ts +1 -0
- package/dist/PageLayout/PageLayout.d.ts.map +1 -1
- package/dist/PageLayout/PageLayout.js +1 -0
- package/dist/RadioGroup/RadioGroup.d.ts +4 -3
- package/dist/RadioGroup/RadioGroup.d.ts.map +1 -1
- package/dist/RadioGroup/RadioGroup.js +1 -0
- package/dist/SegmentedControl/SegmentedControl.d.ts +3 -2
- package/dist/SegmentedControl/SegmentedControl.d.ts.map +1 -1
- package/dist/SegmentedControl/SegmentedControl.js +1 -0
- package/dist/Tooltip/Tooltip.js +1 -1
- package/dist/UnderlineNav/UnderlineNav.d.ts +0 -2
- package/dist/UnderlineNav/UnderlineNav.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNav.js +263 -123
- package/dist/UnderlineNav/UnderlineNavContext.d.ts +1 -10
- package/dist/UnderlineNav/UnderlineNavContext.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavContext.js +0 -2
- package/dist/UnderlineNav/UnderlineNavItem.d.ts +3 -1
- package/dist/UnderlineNav/UnderlineNavItem.d.ts.map +1 -1
- package/dist/UnderlineNav/UnderlineNavItem.js +7 -22
- package/dist/UnderlineNav/types.d.ts +1 -5
- package/dist/UnderlineNav/types.d.ts.map +1 -1
- package/dist/experimental/UnderlinePanels/UnderlinePanels.js +1 -0
- package/dist/hooks/index.d.ts +0 -1
- package/dist/hooks/index.d.ts.map +1 -1
- package/dist/hooks/useSlots.d.ts.map +1 -1
- package/dist/hooks/useSlots.js +0 -24
- package/dist/index.d.ts +1 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +0 -3
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.d.ts +3 -3
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.d.ts.map +1 -1
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroup.js +4 -3
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupCaption.js +1 -1
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupLabel.js +1 -1
- package/dist/internal/components/CheckboxOrRadioGroup/CheckboxOrRadioGroupValidation.js +1 -1
- package/package.json +2 -2
- package/dist/AnchoredOverlay/AnchoredOverlay-ec9e15fc.css +0 -2
- package/dist/AnchoredOverlay/AnchoredOverlay-ec9e15fc.css.map +0 -1
- package/dist/Overlay/Overlay-95cfd3c7.css.map +0 -1
- package/dist/utils/as-slot.d.ts +0 -20
- package/dist/utils/as-slot.d.ts.map +0 -1
- package/dist/utils/as-slot.js +0 -28
|
@@ -15,7 +15,5 @@ export type UnderlineNavProps = {
|
|
|
15
15
|
*/
|
|
16
16
|
variant?: 'inset' | 'flush';
|
|
17
17
|
};
|
|
18
|
-
export declare const MORE_BTN_WIDTH = 86;
|
|
19
|
-
export declare const getValidChildren: (children: React.ReactNode) => React.ReactElement<any>[];
|
|
20
18
|
export declare const UnderlineNav: React.ForwardRefExoticComponent<UnderlineNavProps & React.RefAttributes<unknown>>;
|
|
21
19
|
//# sourceMappingURL=UnderlineNav.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,
|
|
1
|
+
{"version":3,"file":"UnderlineNav.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNav.tsx"],"names":[],"mappings":"AACA,OAAO,KAAsE,MAAM,OAAO,CAAA;AAoB1F,MAAM,MAAM,iBAAiB,GAAG;IAC9B,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAA;IACzB,YAAY,CAAC,EAAE,KAAK,CAAC,cAAc,CAAC,YAAY,CAAC,CAAA;IACjD,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,CAAA;IACtB,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;OAEG;IACH,eAAe,CAAC,EAAE,OAAO,CAAA;IACzB;;;;OAIG;IACH,OAAO,CAAC,EAAE,OAAO,GAAG,OAAO,CAAA;CAC5B,CAAA;AAkHD,eAAO,MAAM,YAAY,mFA+ZxB,CAAA"}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import React, { forwardRef, useRef, useState, useEffect, useCallback } from 'react';
|
|
1
|
+
import React, { forwardRef, useRef, useState, useEffect, useCallback, useMemo } from 'react';
|
|
2
2
|
import { UnderlineNavContext } from './UnderlineNavContext.js';
|
|
3
3
|
import { useResizeObserver } from '../hooks/useResizeObserver.js';
|
|
4
|
+
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
4
5
|
import VisuallyHidden from '../_VisuallyHidden.js';
|
|
5
|
-
import {
|
|
6
|
+
import { baseMenuMinWidth, dividerStyles, menuItemStyles } from './styles.js';
|
|
6
7
|
import { UnderlineWrapper, UnderlineItemList, LoadingCounter, GAP } from '../internal/components/UnderlineTabbedInterface.js';
|
|
7
8
|
import { TriangleDownIcon } from '@primer/octicons-react';
|
|
8
9
|
import { useOnEscapePress } from '../hooks/useOnEscapePress.js';
|
|
@@ -21,19 +22,19 @@ import CounterLabel from '../CounterLabel/CounterLabel.js';
|
|
|
21
22
|
const MORE_BTN_WIDTH = 86;
|
|
22
23
|
// The height is needed to make sure we don't have a layout shift when the more button is the only item in the nav.
|
|
23
24
|
const MORE_BTN_HEIGHT = 45;
|
|
24
|
-
const
|
|
25
|
+
const computeOverflow = (navWidth, moreMenuWidth, childArray, childWidths, noIconChildWidths) => {
|
|
25
26
|
let iconsVisible = true;
|
|
26
|
-
if (
|
|
27
|
-
|
|
27
|
+
if (childWidths.size === 0) {
|
|
28
|
+
return {
|
|
28
29
|
items: childArray,
|
|
29
|
-
menuItems: []
|
|
30
|
-
|
|
31
|
-
|
|
30
|
+
menuItems: [],
|
|
31
|
+
iconsVisible
|
|
32
|
+
};
|
|
32
33
|
}
|
|
33
|
-
const numberOfItemsPossible = calculatePossibleItems(
|
|
34
|
-
const numberOfItemsWithoutIconPossible = calculatePossibleItems(
|
|
34
|
+
const numberOfItemsPossible = calculatePossibleItems(childArray, childWidths, navWidth);
|
|
35
|
+
const numberOfItemsWithoutIconPossible = calculatePossibleItems(childArray, noIconChildWidths, navWidth);
|
|
35
36
|
// We need to take more menu width into account when calculating the number of items possible
|
|
36
|
-
const numberOfItemsPossibleWithMoreMenu = calculatePossibleItems(
|
|
37
|
+
const numberOfItemsPossibleWithMoreMenu = calculatePossibleItems(childArray, noIconChildWidths, navWidth, moreMenuWidth || MORE_BTN_WIDTH);
|
|
37
38
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
38
39
|
const items = [];
|
|
39
40
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
@@ -76,26 +77,27 @@ const overflowEffect = (navWidth, moreMenuWidth, childArray, childWidthArray, no
|
|
|
76
77
|
}
|
|
77
78
|
}
|
|
78
79
|
}
|
|
79
|
-
|
|
80
|
+
return {
|
|
80
81
|
items,
|
|
81
|
-
menuItems
|
|
82
|
-
|
|
82
|
+
menuItems,
|
|
83
|
+
iconsVisible
|
|
84
|
+
};
|
|
83
85
|
};
|
|
84
86
|
const getValidChildren = children => {
|
|
85
87
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
86
88
|
return React.Children.toArray(children).filter(child => /*#__PURE__*/React.isValidElement(child));
|
|
87
89
|
};
|
|
88
|
-
const calculatePossibleItems = (
|
|
90
|
+
const calculatePossibleItems = (childArray, widthMap, navWidth, moreMenuWidth = 0) => {
|
|
89
91
|
const widthToFit = navWidth - moreMenuWidth;
|
|
90
|
-
let breakpoint =
|
|
92
|
+
let breakpoint = childArray.length; // assume all items will fit
|
|
91
93
|
let sumsOfChildWidth = 0;
|
|
92
|
-
for (const [index,
|
|
93
|
-
|
|
94
|
+
for (const [index, child] of childArray.entries()) {
|
|
95
|
+
var _widthMap$get;
|
|
96
|
+
const width = (_widthMap$get = widthMap.get(String(child.key))) !== null && _widthMap$get !== void 0 ? _widthMap$get : 0;
|
|
97
|
+
sumsOfChildWidth = sumsOfChildWidth + width + GAP;
|
|
94
98
|
if (sumsOfChildWidth > widthToFit) {
|
|
95
99
|
breakpoint = index;
|
|
96
100
|
break;
|
|
97
|
-
} else {
|
|
98
|
-
continue;
|
|
99
101
|
}
|
|
100
102
|
}
|
|
101
103
|
return breakpoint;
|
|
@@ -122,7 +124,6 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
|
122
124
|
className,
|
|
123
125
|
children
|
|
124
126
|
}, forwardedRef) => {
|
|
125
|
-
var _listRef$current2;
|
|
126
127
|
const backupRef = useRef(null);
|
|
127
128
|
const navRef = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
128
129
|
const listRef = useRef(null);
|
|
@@ -131,32 +132,70 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
|
131
132
|
const containerRef = React.useRef(null);
|
|
132
133
|
const disclosureWidgetId = useId();
|
|
133
134
|
const [isWidgetOpen, setIsWidgetOpen] = useState(false);
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
const
|
|
135
|
+
// Measurement results are stored in refs because only `computeOverflow` reads them;
|
|
136
|
+
// they should not trigger re-renders. Keyed by `String(element.key)` so lookups
|
|
137
|
+
// are O(1) and survive non-string item children.
|
|
138
|
+
const childWidthsRef = useRef(new Map());
|
|
139
|
+
const noIconChildWidthsRef = useRef(new Map());
|
|
139
140
|
const validChildren = getValidChildren(children);
|
|
141
|
+
// Stable signature of the children list — when it changes we re-run the
|
|
142
|
+
// measurement pass with all items rendered (with icons) in the list. The
|
|
143
|
+
// delimiter is U+0000 (NUL) because React rejects NUL inside element keys,
|
|
144
|
+
// so consumer-provided keys cannot collide with the separator.
|
|
145
|
+
const childrenKey = validChildren.map(c => String(c.key)).join('\u0000');
|
|
146
|
+
|
|
147
|
+
// Single consolidated overflow state. Bundling `items`, `menuItems`,
|
|
148
|
+
// `iconsVisible`, `measured`, and `childrenKey` together means every
|
|
149
|
+
// overflow update — measurement, swap, resize, or children-change reset —
|
|
150
|
+
// is exactly one setState call (one commit), instead of fanning out to
|
|
151
|
+
// multiple back-to-back commits.
|
|
140
152
|
|
|
141
|
-
|
|
142
|
-
const [responsiveProps, setResponsiveProps] = useState({
|
|
153
|
+
const [overflowState, setOverflowState] = useState(() => ({
|
|
143
154
|
items: validChildren,
|
|
144
|
-
menuItems: []
|
|
145
|
-
|
|
155
|
+
menuItems: [],
|
|
156
|
+
iconsVisible: true,
|
|
157
|
+
measured: false,
|
|
158
|
+
childrenKey
|
|
159
|
+
}));
|
|
160
|
+
|
|
161
|
+
// Derived-state reset: when the children list changes, push everything back into
|
|
162
|
+
// the list (with icons) so the next layout effect can measure all items in one
|
|
163
|
+
// pass. This is React's recommended "store information from previous renders"
|
|
164
|
+
// pattern — calling setState during render lets React discard the in-progress
|
|
165
|
+
// render and re-render immediately with the reset state, before paint.
|
|
166
|
+
if (overflowState.childrenKey !== childrenKey) {
|
|
167
|
+
setOverflowState({
|
|
168
|
+
items: validChildren,
|
|
169
|
+
menuItems: [],
|
|
170
|
+
iconsVisible: true,
|
|
171
|
+
measured: false,
|
|
172
|
+
childrenKey
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
|
|
176
|
+
// Build a key-indexed view of validChildren once per render so the listItems /
|
|
177
|
+
// menuItems prop-refresh below is O(N) instead of O(N^2) via Array.prototype.find.
|
|
178
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
179
|
+
const validChildrenByKey = new Map();
|
|
180
|
+
for (const c of validChildren) validChildrenByKey.set(String(c.key), c);
|
|
181
|
+
const {
|
|
182
|
+
iconsVisible,
|
|
183
|
+
measured: isOverflowMeasured
|
|
184
|
+
} = overflowState;
|
|
146
185
|
|
|
147
186
|
// Make sure to have the fresh props data for list items when children are changed (keeping aria-current up-to-date)
|
|
148
|
-
const listItems =
|
|
149
|
-
var
|
|
150
|
-
return (
|
|
187
|
+
const listItems = overflowState.items.map(item => {
|
|
188
|
+
var _validChildrenByKey$g;
|
|
189
|
+
return (_validChildrenByKey$g = validChildrenByKey.get(String(item.key))) !== null && _validChildrenByKey$g !== void 0 ? _validChildrenByKey$g : item;
|
|
151
190
|
});
|
|
152
191
|
|
|
153
192
|
// Make sure to have the fresh props data for menu items when children are changed (keeping aria-current up-to-date)
|
|
154
|
-
const menuItems =
|
|
155
|
-
var
|
|
156
|
-
return (
|
|
193
|
+
const menuItems = overflowState.menuItems.map(item => {
|
|
194
|
+
var _validChildrenByKey$g2;
|
|
195
|
+
return (_validChildrenByKey$g2 = validChildrenByKey.get(String(item.key))) !== null && _validChildrenByKey$g2 !== void 0 ? _validChildrenByKey$g2 : item;
|
|
157
196
|
});
|
|
158
197
|
// This is the case where the viewport is too narrow to show any list item with the more menu. In this case, we only show the dropdown
|
|
159
|
-
const onlyMenuVisible =
|
|
198
|
+
const onlyMenuVisible = overflowState.items.length === 0;
|
|
160
199
|
if (process.env.NODE_ENV !== "production") {
|
|
161
200
|
// Practically, this is not a conditional hook, it is just making sure this hook runs only on DEV not PROD.
|
|
162
201
|
// eslint-disable-next-line react-hooks/rules-of-hooks
|
|
@@ -169,66 +208,145 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
|
169
208
|
!ariaLabel ? process.env.NODE_ENV !== "production" ? invariant(false, 'Use the `aria-label` prop to provide an accessible label for assistive technology') : invariant(false) : void 0;
|
|
170
209
|
});
|
|
171
210
|
}
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
211
|
+
|
|
212
|
+
// Returns the measured "no icon" width for an item, looking up by element key.
|
|
213
|
+
// Previously this was a text-based lookup, which silently returned 0 when an
|
|
214
|
+
// item's children weren't a plain string and caused the swap math to degenerate.
|
|
215
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
216
|
+
const getItemNoIconWidth = item => {
|
|
217
|
+
var _noIconChildWidthsRef;
|
|
218
|
+
return (_noIconChildWidthsRef = noIconChildWidthsRef.current.get(String(item.key))) !== null && _noIconChildWidthsRef !== void 0 ? _noIconChildWidthsRef : 0;
|
|
219
|
+
};
|
|
220
|
+
|
|
221
|
+
// Pure: returns the {items, menuItems} that result from promoting
|
|
222
|
+
// `prospectiveListItem` (currently at position `indexOfProspectiveListItem`
|
|
223
|
+
// in `currentMenuItems`) into `currentItems`. Does not call setState.
|
|
224
|
+
const computeSwap = (currentItems, currentMenuItems, prospectiveListItem, indexOfProspectiveListItem) => {
|
|
177
225
|
var _navRef$current$getBo, _navRef$current, _listRef$current$getB, _listRef$current;
|
|
178
|
-
|
|
179
|
-
const widthToFitIntoList = getItemsWidth(prospectiveListItem.props.children);
|
|
180
|
-
// Check if there is any empty space on the right side of the list
|
|
226
|
+
const widthToFitIntoList = getItemNoIconWidth(prospectiveListItem);
|
|
181
227
|
const availableSpace = ((_navRef$current$getBo = (_navRef$current = navRef.current) === null || _navRef$current === void 0 ? void 0 : _navRef$current.getBoundingClientRect().width) !== null && _navRef$current$getBo !== void 0 ? _navRef$current$getBo : 0) - ((_listRef$current$getB = (_listRef$current = listRef.current) === null || _listRef$current === void 0 ? void 0 : _listRef$current.getBoundingClientRect().width) !== null && _listRef$current$getB !== void 0 ? _listRef$current$getB : 0);
|
|
182
228
|
|
|
183
|
-
//
|
|
184
|
-
//
|
|
185
|
-
const index = getBreakpointForItemSwapping(widthToFitIntoList, availableSpace);
|
|
186
|
-
const indexToSliceAt = responsiveProps.items.length - 1 - index;
|
|
187
|
-
// Form the new list of items
|
|
188
|
-
const itemsLeftInList = [...responsiveProps.items].slice(0, indexToSliceAt);
|
|
189
|
-
const updatedItemList = [...itemsLeftInList, prospectiveListItem];
|
|
190
|
-
// Form the new menu items
|
|
191
|
-
const itemsToAddToMenu = [...responsiveProps.items].slice(indexToSliceAt);
|
|
192
|
-
const updatedMenuItems = [...menuItems];
|
|
193
|
-
// Add itemsToAddToMenu array's items to the menu at the index of the prospectiveListItem and remove 1 count of items (prospectiveListItem)
|
|
194
|
-
updatedMenuItems.splice(indexOfProspectiveListItem, 1, ...itemsToAddToMenu);
|
|
195
|
-
callback({
|
|
196
|
-
items: updatedItemList,
|
|
197
|
-
menuItems: updatedMenuItems
|
|
198
|
-
}, false, true);
|
|
199
|
-
};
|
|
200
|
-
// How many items do we need to pull in to the menu to make room for the selected menu item.
|
|
201
|
-
function getBreakpointForItemSwapping(widthToFitIntoList, availableSpace) {
|
|
229
|
+
// How many items at the end of the list have to move to the menu to make
|
|
230
|
+
// room for the promoted item.
|
|
202
231
|
let widthToSwap = 0;
|
|
203
232
|
let breakpoint = 0;
|
|
204
|
-
for (const [index, item] of [...
|
|
205
|
-
widthToSwap +=
|
|
233
|
+
for (const [index, item] of [...currentItems].reverse().entries()) {
|
|
234
|
+
widthToSwap += getItemNoIconWidth(item);
|
|
206
235
|
if (widthToFitIntoList < widthToSwap + availableSpace) {
|
|
207
236
|
breakpoint = index;
|
|
208
237
|
break;
|
|
209
238
|
}
|
|
210
239
|
}
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
240
|
+
const indexToSliceAt = currentItems.length - 1 - breakpoint;
|
|
241
|
+
const itemsLeftInList = currentItems.slice(0, indexToSliceAt);
|
|
242
|
+
const updatedItemList = [...itemsLeftInList, prospectiveListItem];
|
|
243
|
+
const itemsToAddToMenu = currentItems.slice(indexToSliceAt);
|
|
244
|
+
const updatedMenuItems = [...currentMenuItems];
|
|
245
|
+
updatedMenuItems.splice(indexOfProspectiveListItem, 1, ...itemsToAddToMenu);
|
|
246
|
+
return {
|
|
247
|
+
items: updatedItemList,
|
|
248
|
+
menuItems: updatedMenuItems
|
|
249
|
+
};
|
|
250
|
+
};
|
|
251
|
+
const swapMenuItemWithListItem = (prospectiveListItem, indexOfProspectiveListItem) => {
|
|
252
|
+
const swap = computeSwap(overflowState.items, menuItems, prospectiveListItem, indexOfProspectiveListItem);
|
|
253
|
+
setOverflowState(prev => ({
|
|
254
|
+
items: swap.items,
|
|
255
|
+
menuItems: swap.menuItems,
|
|
256
|
+
iconsVisible: false,
|
|
257
|
+
measured: true,
|
|
258
|
+
childrenKey: prev.childrenKey
|
|
259
|
+
}));
|
|
260
|
+
};
|
|
261
|
+
|
|
262
|
+
// Single combined layout effect that performs measurement (when needed) and
|
|
263
|
+
// the external-aria-current promotion (when needed), then commits at most
|
|
264
|
+
// one setOverflowState per pass. Replaces the previous two effects (each of
|
|
265
|
+
// which produced its own commit) and removes the render-phase setState that
|
|
266
|
+
// the original component used to do the same swap from inside menuItems.map.
|
|
267
|
+
//
|
|
268
|
+
// Why no deps array: the swap branch depends on `aria-current` which lives
|
|
269
|
+
// on item props (not on `overflowState`); a deps-driven effect would not
|
|
270
|
+
// notice prop-only changes without rebuilding a signature. The body
|
|
271
|
+
// short-circuits cheaply on every render where neither pass needs to run.
|
|
272
|
+
useIsomorphicLayoutEffect(() => {
|
|
273
|
+
var _next;
|
|
274
|
+
const listEl = listRef.current;
|
|
275
|
+
const navEl = navRef.current;
|
|
276
|
+
if (!listEl || !navEl) return;
|
|
277
|
+
let next = null;
|
|
278
|
+
|
|
279
|
+
// Pass 1: measurement (runs once after each remeasure trigger).
|
|
280
|
+
if (!isOverflowMeasured) {
|
|
281
|
+
var _moreMenuRef$current$, _moreMenuRef$current;
|
|
282
|
+
const widths = new Map();
|
|
283
|
+
const noIconWidths = new Map();
|
|
284
|
+
const itemEls = listEl.querySelectorAll('[data-underlinenav-item="true"]');
|
|
285
|
+
|
|
286
|
+
// The N-th [data-underlinenav-item] element corresponds to validChildren[N]
|
|
287
|
+
// because the measurement pass runs only when all items are in the list,
|
|
288
|
+
// in render order. Pair them up positionally so we can key widths by the
|
|
289
|
+
// element's React key.
|
|
290
|
+
const upToBoundary = Math.min(itemEls.length, validChildren.length);
|
|
291
|
+
for (let index = 0; index < upToBoundary; index++) {
|
|
292
|
+
const liEl = itemEls[index];
|
|
293
|
+
const linkEl = liEl.querySelector('a, button');
|
|
294
|
+
if (!linkEl) continue;
|
|
295
|
+
const child = validChildren[index];
|
|
296
|
+
const key = String(child.key);
|
|
297
|
+
const domRect = linkEl.getBoundingClientRect();
|
|
298
|
+
const iconEl = linkEl.querySelector('[data-component="icon"]');
|
|
299
|
+
let iconWidthWithMargin = 0;
|
|
300
|
+
if (iconEl) {
|
|
301
|
+
const style = getComputedStyle(iconEl);
|
|
302
|
+
iconWidthWithMargin = iconEl.getBoundingClientRect().width + (parseFloat(style.marginRight) || 0) + (parseFloat(style.marginLeft) || 0);
|
|
303
|
+
}
|
|
304
|
+
widths.set(key, domRect.width);
|
|
305
|
+
noIconWidths.set(key, domRect.width - iconWidthWithMargin);
|
|
306
|
+
}
|
|
307
|
+
childWidthsRef.current = widths;
|
|
308
|
+
noIconChildWidthsRef.current = noIconWidths;
|
|
309
|
+
const navWidth = navEl.getBoundingClientRect().width;
|
|
310
|
+
if (navWidth === 0) return;
|
|
311
|
+
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;
|
|
312
|
+
const result = computeOverflow(navWidth, moreMenuWidth, validChildren, widths, noIconWidths);
|
|
313
|
+
next = {
|
|
314
|
+
items: result.items,
|
|
315
|
+
menuItems: result.menuItems,
|
|
316
|
+
iconsVisible: result.iconsVisible,
|
|
317
|
+
measured: true,
|
|
318
|
+
childrenKey: overflowState.childrenKey
|
|
319
|
+
};
|
|
218
320
|
}
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
321
|
+
|
|
322
|
+
// Pass 2: external-aria-current promotion. Operates on the freshest
|
|
323
|
+
// (post-measurement) items so it can fold into the same setState.
|
|
324
|
+
const considered = (_next = next) !== null && _next !== void 0 ? _next : overflowState;
|
|
325
|
+
if (considered.measured && considered.items.length > 0) {
|
|
326
|
+
// Look at FRESH props (current aria-current) by remapping through
|
|
327
|
+
// validChildrenByKey (O(1) per lookup; the previous .find() pattern was
|
|
328
|
+
// O(N) and ran inside a .map() — quadratic on every commit).
|
|
329
|
+
const freshMenuItems = considered.menuItems.map(item => {
|
|
330
|
+
var _validChildrenByKey$g3;
|
|
331
|
+
return (_validChildrenByKey$g3 = validChildrenByKey.get(String(item.key))) !== null && _validChildrenByKey$g3 !== void 0 ? _validChildrenByKey$g3 : item;
|
|
332
|
+
});
|
|
333
|
+
const indexOfCurrent = freshMenuItems.findIndex(item => {
|
|
334
|
+
const c = item.props['aria-current'];
|
|
335
|
+
return Boolean(c) && c !== 'false';
|
|
336
|
+
});
|
|
337
|
+
if (indexOfCurrent !== -1) {
|
|
338
|
+
const swap = computeSwap(considered.items, freshMenuItems, freshMenuItems[indexOfCurrent], indexOfCurrent);
|
|
339
|
+
next = {
|
|
340
|
+
items: swap.items,
|
|
341
|
+
menuItems: swap.menuItems,
|
|
342
|
+
iconsVisible: false,
|
|
343
|
+
measured: true,
|
|
344
|
+
childrenKey: considered.childrenKey
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (next) setOverflowState(next);
|
|
349
|
+
});
|
|
232
350
|
const closeOverlay = React.useCallback(() => {
|
|
233
351
|
setIsWidgetOpen(false);
|
|
234
352
|
}, [setIsWidgetOpen]);
|
|
@@ -255,36 +373,66 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
|
255
373
|
ignoreClickRefs: [moreMenuBtnRef]
|
|
256
374
|
});
|
|
257
375
|
useResizeObserver(resizeObserverEntries => {
|
|
258
|
-
var _moreMenuRef$current
|
|
376
|
+
var _moreMenuRef$current$2, _moreMenuRef$current2;
|
|
259
377
|
const navWidth = resizeObserverEntries[0].contentRect.width;
|
|
260
|
-
|
|
261
|
-
|
|
378
|
+
if (navWidth === 0) return;
|
|
379
|
+
const moreMenuWidth = (_moreMenuRef$current$2 = (_moreMenuRef$current2 = moreMenuRef.current) === null || _moreMenuRef$current2 === void 0 ? void 0 : _moreMenuRef$current2.getBoundingClientRect().width) !== null && _moreMenuRef$current$2 !== void 0 ? _moreMenuRef$current$2 : 0;
|
|
380
|
+
const result = computeOverflow(navWidth, moreMenuWidth, validChildren, childWidthsRef.current, noIconChildWidthsRef.current);
|
|
381
|
+
setOverflowState(prev => ({
|
|
382
|
+
items: result.items,
|
|
383
|
+
menuItems: result.menuItems,
|
|
384
|
+
iconsVisible: result.iconsVisible,
|
|
385
|
+
measured: childWidthsRef.current.size > 0 || prev.measured,
|
|
386
|
+
childrenKey: prev.childrenKey
|
|
387
|
+
}));
|
|
262
388
|
}, navRef);
|
|
263
389
|
|
|
264
|
-
//
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
390
|
+
// Menu anchor position. `undefined` means "use the default right: 0 from
|
|
391
|
+
// baseMenuInlineStyles" (the list is wide enough that no anchoring is
|
|
392
|
+
// needed). A number means the menu is anchored to that `left` coordinate,
|
|
393
|
+
// overriding right.
|
|
394
|
+
//
|
|
395
|
+
// This used to be computed inline during render by reading
|
|
396
|
+
// containerRef.current / listRef.current — refs are mutable and unsafe to
|
|
397
|
+
// read during render under concurrent rendering (the first render saw null
|
|
398
|
+
// refs and fell through to the unanchored fallback; subsequent renders
|
|
399
|
+
// anchored differently, producing a perceptible reflow).
|
|
400
|
+
const [menuAnchorLeft, setMenuAnchorLeft] = useState(undefined);
|
|
401
|
+
useIsomorphicLayoutEffect(() => {
|
|
402
|
+
const container = containerRef.current;
|
|
403
|
+
const list = listRef.current;
|
|
404
|
+
if (!container || !list) return;
|
|
405
|
+
if (list.clientWidth >= baseMenuMinWidth) {
|
|
406
|
+
if (menuAnchorLeft !== undefined) setMenuAnchorLeft(undefined);
|
|
407
|
+
return;
|
|
408
|
+
}
|
|
269
409
|
const {
|
|
270
410
|
left
|
|
271
|
-
} = getAnchoredPosition(
|
|
411
|
+
} = getAnchoredPosition(container, list, {
|
|
272
412
|
align: 'start',
|
|
273
413
|
side: 'outside-bottom'
|
|
274
414
|
});
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
415
|
+
if (menuAnchorLeft !== left) setMenuAnchorLeft(left);
|
|
416
|
+
}, [isWidgetOpen, isOverflowMeasured, menuItems.length, menuAnchorLeft]);
|
|
417
|
+
|
|
418
|
+
// Stable context value: a fresh object literal here would re-render every
|
|
419
|
+
// consumer (UnderlineNav.Item) on every parent re-render, undoing the
|
|
420
|
+
// React.memo on UnderlineNavItem.
|
|
421
|
+
const contextValue = useMemo(() => ({
|
|
422
|
+
loadingCounters,
|
|
423
|
+
iconsVisible
|
|
424
|
+
}), [loadingCounters, iconsVisible]);
|
|
425
|
+
const menuStyle = menuAnchorLeft !== undefined ? {
|
|
426
|
+
...baseMenuInlineStyles,
|
|
427
|
+
right: undefined,
|
|
428
|
+
left: menuAnchorLeft,
|
|
429
|
+
display: isWidgetOpen ? 'block' : 'none'
|
|
430
|
+
} : {
|
|
431
|
+
...baseMenuInlineStyles,
|
|
432
|
+
display: isWidgetOpen ? 'block' : 'none'
|
|
433
|
+
};
|
|
281
434
|
return /*#__PURE__*/jsxs(UnderlineNavContext.Provider, {
|
|
282
|
-
value:
|
|
283
|
-
setChildrenWidth,
|
|
284
|
-
setNoIconChildrenWidth,
|
|
285
|
-
loadingCounters,
|
|
286
|
-
iconsVisible
|
|
287
|
-
},
|
|
435
|
+
value: contextValue,
|
|
288
436
|
children: [ariaLabel && /*#__PURE__*/jsx(VisuallyHidden, {
|
|
289
437
|
as: "h2",
|
|
290
438
|
children: `${ariaLabel} navigation`
|
|
@@ -331,31 +479,23 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
|
331
479
|
selectionVariant: "single",
|
|
332
480
|
ref: containerRef,
|
|
333
481
|
id: disclosureWidgetId,
|
|
334
|
-
style:
|
|
335
|
-
...((_listRef$current2 = listRef.current) !== null && _listRef$current2 !== void 0 && _listRef$current2.clientWidth && listRef.current.clientWidth >= baseMenuMinWidth ? baseMenuInlineStyles : menuInlineStyles),
|
|
336
|
-
display: isWidgetOpen ? 'block' : 'none'
|
|
337
|
-
},
|
|
482
|
+
style: menuStyle,
|
|
338
483
|
children: menuItems.map((menuItem, index) => {
|
|
339
484
|
const {
|
|
340
485
|
children: menuItemChildren,
|
|
341
486
|
counter,
|
|
342
|
-
|
|
487
|
+
// Stripped from the spread below; the swap effect reads aria-current
|
|
488
|
+
// directly from item.props (not via these destructured locals).
|
|
489
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
490
|
+
'aria-current': _ariaCurrent,
|
|
343
491
|
onSelect,
|
|
344
492
|
...menuItemProps
|
|
345
493
|
} = menuItem.props;
|
|
346
|
-
|
|
347
|
-
// This logic is used to pop the selected item out of the menu and into the list when the navigation is control externally
|
|
348
|
-
if (Boolean(ariaCurrent) && ariaCurrent !== 'false') {
|
|
349
|
-
const event = new MouseEvent('click');
|
|
350
|
-
!onlyMenuVisible && swapMenuItemWithListItem(menuItem, index,
|
|
351
|
-
// @ts-ignore - not a big deal because it is internally creating an event but ask help
|
|
352
|
-
event, updateListAndMenu);
|
|
353
|
-
}
|
|
354
494
|
return /*#__PURE__*/jsx(ActionList.LinkItem, {
|
|
355
495
|
style: menuItemStyles,
|
|
356
496
|
onClick: event => {
|
|
357
497
|
// When there are no items in the list, do not run the swap function as we want to keep everything in the menu.
|
|
358
|
-
!onlyMenuVisible && swapMenuItemWithListItem(menuItem, index
|
|
498
|
+
!onlyMenuVisible && swapMenuItemWithListItem(menuItem, index);
|
|
359
499
|
closeOverlay();
|
|
360
500
|
focusOnMoreMenuBtn();
|
|
361
501
|
// fire onSelect event that comes from the UnderlineNav.Item (if it is defined)
|
|
@@ -371,7 +511,7 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
|
371
511
|
})
|
|
372
512
|
})]
|
|
373
513
|
})
|
|
374
|
-
},
|
|
514
|
+
}, String(menuItem.key));
|
|
375
515
|
})
|
|
376
516
|
})]
|
|
377
517
|
})]
|
|
@@ -381,4 +521,4 @@ const UnderlineNav = /*#__PURE__*/forwardRef(({
|
|
|
381
521
|
});
|
|
382
522
|
UnderlineNav.displayName = 'UnderlineNav';
|
|
383
523
|
|
|
384
|
-
export {
|
|
524
|
+
export { UnderlineNav };
|
|
@@ -1,13 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
export declare const UnderlineNavContext: React.Context<{
|
|
3
|
-
setChildrenWidth: React.Dispatch<{
|
|
4
|
-
text: string;
|
|
5
|
-
width: number;
|
|
6
|
-
}>;
|
|
7
|
-
setNoIconChildrenWidth: React.Dispatch<{
|
|
8
|
-
text: string;
|
|
9
|
-
width: number;
|
|
10
|
-
}>;
|
|
1
|
+
export declare const UnderlineNavContext: import("react").Context<{
|
|
11
2
|
loadingCounters: boolean;
|
|
12
3
|
iconsVisible: boolean;
|
|
13
4
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlineNavContext.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavContext.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"UnderlineNavContext.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavContext.tsx"],"names":[],"mappings":"AAEA,eAAO,MAAM,mBAAmB;qBACb,OAAO;kBACV,OAAO;EAIrB,CAAA"}
|
|
@@ -43,5 +43,7 @@ export type UnderlineNavItemProps = {
|
|
|
43
43
|
*/
|
|
44
44
|
counter?: number | string;
|
|
45
45
|
} & LinkProps;
|
|
46
|
-
|
|
46
|
+
declare const UnderlineNavItemImpl: PolymorphicForwardRefComponent<"a", UnderlineNavItemProps>;
|
|
47
|
+
export declare const UnderlineNavItem: typeof UnderlineNavItemImpl;
|
|
48
|
+
export {};
|
|
47
49
|
//# sourceMappingURL=UnderlineNavItem.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"UnderlineNavItem.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuC,MAAM,OAAO,CAAA;AAC3D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;
|
|
1
|
+
{"version":3,"file":"UnderlineNavItem.d.ts","sourceRoot":"","sources":["../../src/UnderlineNav/UnderlineNavItem.tsx"],"names":[],"mappings":"AACA,OAAO,KAAuC,MAAM,OAAO,CAAA;AAC3D,OAAO,KAAK,EAAC,SAAS,EAAC,MAAM,wBAAwB,CAAA;AACrD,OAAO,KAAK,EAAC,mBAAmB,IAAI,8BAA8B,EAAC,MAAM,sBAAsB,CAAA;AAM/F,MAAM,MAAM,SAAS,GAAG;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,IAAI,CAAC,EAAE,MAAM,CAAA;IACb,cAAc,CAAC,EAAE,KAAK,CAAC,oBAAoB,CAAC,iBAAiB,CAAC,CAAC,gBAAgB,CAAC,CAAA;CACjF,CAAA;AAED,MAAM,MAAM,qBAAqB,GAAG;IAClC;;OAEG;IACH,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;IAE1B;;OAEG;IACH,QAAQ,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC,UAAU,CAAC,iBAAiB,CAAC,GAAG,KAAK,CAAC,aAAa,CAAC,iBAAiB,CAAC,KAAK,IAAI,CAAA;IAExG;;OAEG;IACH,cAAc,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,OAAO,CAAA;IAE5F;;;OAGG;IAEH,IAAI,CAAC,EAAE,KAAK,CAAC,iBAAiB,CAAC,SAAS,CAAC,GAAG,KAAK,CAAC,YAAY,CAAC,GAAG,CAAC,CAAA;IAEnE;;OAEG;IACH,aAAa,CAAC,EAAE,KAAK,CAAC,YAAY,CAAA;IAElC;;QAEI;IACJ,EAAE,CAAC,EAAE,KAAK,CAAC,WAAW,GAAG,GAAG,CAAA;IAE5B;;OAEG;IACH,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CAC1B,GAAG,SAAS,CAAA;AAEb,QAAA,MAAM,oBAAoB,EAwDrB,8BAA8B,CAAC,GAAG,EAAE,qBAAqB,CAAC,CAAA;AAK/D,eAAO,MAAM,gBAAgB,EAAkD,OAAO,oBAAoB,CAAA"}
|
|
@@ -1,11 +1,10 @@
|
|
|
1
1
|
import React, { forwardRef, useRef, useContext } from 'react';
|
|
2
2
|
import { UnderlineNavContext } from './UnderlineNavContext.js';
|
|
3
|
-
import useIsomorphicLayoutEffect from '../utils/useIsomorphicLayoutEffect.js';
|
|
4
3
|
import { UnderlineItem } from '../internal/components/UnderlineTabbedInterface.js';
|
|
5
4
|
import classes from './UnderlineNavItem.module.css.js';
|
|
6
5
|
import { jsx } from 'react/jsx-runtime';
|
|
7
6
|
|
|
8
|
-
const
|
|
7
|
+
const UnderlineNavItemImpl = /*#__PURE__*/forwardRef(({
|
|
9
8
|
as: Component = 'a',
|
|
10
9
|
href = '#',
|
|
11
10
|
children,
|
|
@@ -19,28 +18,9 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef(({
|
|
|
19
18
|
const backupRef = useRef(null);
|
|
20
19
|
const ref = forwardedRef !== null && forwardedRef !== void 0 ? forwardedRef : backupRef;
|
|
21
20
|
const {
|
|
22
|
-
setChildrenWidth,
|
|
23
|
-
setNoIconChildrenWidth,
|
|
24
21
|
loadingCounters,
|
|
25
22
|
iconsVisible
|
|
26
23
|
} = useContext(UnderlineNavContext);
|
|
27
|
-
useIsomorphicLayoutEffect(() => {
|
|
28
|
-
if (ref.current) {
|
|
29
|
-
const domRect = ref.current.getBoundingClientRect();
|
|
30
|
-
const icon = Array.from(ref.current.children).find(child => child.getAttribute('data-component') === 'icon');
|
|
31
|
-
const content = Array.from(ref.current.children).find(child => child.getAttribute('data-component') === 'text');
|
|
32
|
-
const text = content.textContent;
|
|
33
|
-
const iconWidthWithMargin = icon ? icon.getBoundingClientRect().width + Number(getComputedStyle(icon).marginRight.slice(0, -2)) + Number(getComputedStyle(icon).marginLeft.slice(0, -2)) : 0;
|
|
34
|
-
setChildrenWidth({
|
|
35
|
-
text,
|
|
36
|
-
width: domRect.width
|
|
37
|
-
});
|
|
38
|
-
setNoIconChildrenWidth({
|
|
39
|
-
text,
|
|
40
|
-
width: domRect.width - iconWidthWithMargin
|
|
41
|
-
});
|
|
42
|
-
}
|
|
43
|
-
}, [ref, setChildrenWidth, setNoIconChildrenWidth]);
|
|
44
24
|
const keyDownHandler = React.useCallback(event => {
|
|
45
25
|
if ((event.key === ' ' || event.key === 'Enter') && !event.defaultPrevented && typeof onSelect === 'function') {
|
|
46
26
|
onSelect(event);
|
|
@@ -53,6 +33,7 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef(({
|
|
|
53
33
|
}, [onSelect]);
|
|
54
34
|
return /*#__PURE__*/jsx("li", {
|
|
55
35
|
className: classes.UnderlineNavItem,
|
|
36
|
+
"data-underlinenav-item": "true",
|
|
56
37
|
children: /*#__PURE__*/jsx(UnderlineItem, {
|
|
57
38
|
ref: ref,
|
|
58
39
|
as: Component,
|
|
@@ -69,6 +50,10 @@ const UnderlineNavItem = /*#__PURE__*/forwardRef(({
|
|
|
69
50
|
})
|
|
70
51
|
});
|
|
71
52
|
});
|
|
72
|
-
|
|
53
|
+
UnderlineNavItemImpl.displayName = 'UnderlineNavItem';
|
|
54
|
+
|
|
55
|
+
// Memoized so that re-renders of UnderlineNav (e.g. when overflow state changes)
|
|
56
|
+
// do not re-render every item when the consumer-provided children haven't changed.
|
|
57
|
+
const UnderlineNavItem = /*#__PURE__*/React.memo(UnderlineNavItemImpl);
|
|
73
58
|
|
|
74
59
|
export { UnderlineNavItem };
|
|
@@ -1,8 +1,4 @@
|
|
|
1
|
-
export type
|
|
2
|
-
text: string;
|
|
3
|
-
width: number;
|
|
4
|
-
};
|
|
5
|
-
export type ChildWidthArray = Array<ChildSize>;
|
|
1
|
+
export type ChildWidthMap = Map<string, number>;
|
|
6
2
|
export type ResponsiveProps = {
|
|
7
3
|
items: Array<React.ReactElement<any>>;
|
|
8
4
|
menuItems: Array<React.ReactElement<any>>;
|