@evoke-platform/ui-components 1.6.0-testing.10 → 1.6.0-testing.11
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.
|
@@ -60,21 +60,17 @@ export const ResponsiveOverflow = (props) => {
|
|
|
60
60
|
}
|
|
61
61
|
});
|
|
62
62
|
const availableWidth = containerRef.current.getBoundingClientRect().width;
|
|
63
|
+
const moreButtonWidth = moreButtonBoxRef.current?.getBoundingClientRect().width ?? 0;
|
|
63
64
|
let usedWidth = 0;
|
|
64
65
|
let maxFit = children.length;
|
|
65
|
-
// Determine which items fit
|
|
66
|
+
// Determine which items fit, accounting for overflow button width
|
|
66
67
|
for (let i = 0; i < itemRefs.current.length; i++) {
|
|
67
68
|
const item = itemRefs.current[i];
|
|
68
69
|
if (!item) {
|
|
69
70
|
continue;
|
|
70
71
|
}
|
|
71
72
|
const itemWidth = item.getBoundingClientRect().width;
|
|
72
|
-
|
|
73
|
-
const remainingItems = itemRefs.current.length - i - 1;
|
|
74
|
-
const moreButtonWidth = remainingItems > 0 && moreButtonBoxRef.current
|
|
75
|
-
? moreButtonBoxRef.current.getBoundingClientRect().width
|
|
76
|
-
: 0;
|
|
77
|
-
if (usedWidth + itemWidth + (remainingItems > 0 ? moreButtonWidth : 0) > availableWidth) {
|
|
73
|
+
if (usedWidth + itemWidth + moreButtonWidth > availableWidth) {
|
|
78
74
|
maxFit = i;
|
|
79
75
|
break;
|
|
80
76
|
}
|