@dloizides/ui-layout 1.26.0 → 1.26.2
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 +619 -586
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +8 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -454,6 +454,10 @@ function observeLayout(node, onChange) {
|
|
|
454
454
|
observer.observe(document.body);
|
|
455
455
|
return observer;
|
|
456
456
|
}
|
|
457
|
+
function isSameRect(a, b) {
|
|
458
|
+
if (a === null || b === null) return a === b;
|
|
459
|
+
return a.top === b.top && a.left === b.left && a.width === b.width && a.bottom === b.bottom;
|
|
460
|
+
}
|
|
457
461
|
function useAnchorTracking(containerRef, onOutOfView) {
|
|
458
462
|
const [rect, setRect] = useState(() => readAnchorRect(containerRef));
|
|
459
463
|
useLayoutEffect(() => {
|
|
@@ -465,7 +469,7 @@ function useAnchorTracking(containerRef, onOutOfView) {
|
|
|
465
469
|
frame = null;
|
|
466
470
|
if (isDisposed) return;
|
|
467
471
|
const next = readAnchorRect(containerRef);
|
|
468
|
-
setRect(next);
|
|
472
|
+
setRect((previous) => isSameRect(previous, next) ? previous : next);
|
|
469
473
|
const isHidden = next !== null && isAnchorHidden(next, readClipBounds(toDomNode(containerRef)), MIN_VISIBLE_PX);
|
|
470
474
|
if (hasMeasured && isHidden) onOutOfView();
|
|
471
475
|
hasMeasured = true;
|
|
@@ -586,6 +590,7 @@ var InlineMenu = ({
|
|
|
586
590
|
value,
|
|
587
591
|
options,
|
|
588
592
|
containerRef,
|
|
593
|
+
isOpen,
|
|
589
594
|
optionTestID,
|
|
590
595
|
menuMinWidth = 0,
|
|
591
596
|
animatedStyle,
|
|
@@ -617,7 +622,7 @@ var InlineMenu = ({
|
|
|
617
622
|
useMenuKeyboard({
|
|
618
623
|
containerRef,
|
|
619
624
|
menuRef,
|
|
620
|
-
enabled:
|
|
625
|
+
enabled: isOpen,
|
|
621
626
|
itemCount: options.length,
|
|
622
627
|
onHighlightChange: setHighlightedIndex,
|
|
623
628
|
onSelectHighlighted: selectHighlighted,
|
|
@@ -856,6 +861,7 @@ var ModalDropdown = ({
|
|
|
856
861
|
accessibilityLabel,
|
|
857
862
|
animatedStyle: menuAnim.style,
|
|
858
863
|
containerRef: anchorRef,
|
|
864
|
+
isOpen,
|
|
859
865
|
menuMinWidth,
|
|
860
866
|
optionTestID: optionTestIDFor,
|
|
861
867
|
options,
|