@dloizides/ui-layout 1.26.2 → 1.26.3
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 +12 -0
- package/dist/index.js +28 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -580,6 +580,8 @@ var styles6 = StyleSheet.create({
|
|
|
580
580
|
// node (the `menuRef` outside-click / keyboard logic and the web portal target depend on it).
|
|
581
581
|
// `transformOrigin: 'top'` makes the scale grow downward FROM the anchor rather than the centre.
|
|
582
582
|
animated: { transformOrigin: "top" },
|
|
583
|
+
// Exit fade only: the dying popover must not receive the next click. See the file header.
|
|
584
|
+
inert: { pointerEvents: "none" },
|
|
583
585
|
// Bound the scroll viewport so a list longer than the popover scrolls (with a scrollbar) instead of
|
|
584
586
|
// overflowing the frame — the popover's own maxHeight cannot do this (see MENU_SCROLL_MAX_HEIGHT).
|
|
585
587
|
scroll: { maxHeight: MENU_SCROLL_MAX_HEIGHT }
|
|
@@ -606,12 +608,18 @@ var InlineMenu = ({
|
|
|
606
608
|
[options, value]
|
|
607
609
|
);
|
|
608
610
|
const [highlightedIndex, setHighlightedIndex] = useState(() => selectedIndex);
|
|
611
|
+
const handleSelect = useCallback(
|
|
612
|
+
(optionValue) => {
|
|
613
|
+
if (isOpen) onSelect(optionValue);
|
|
614
|
+
},
|
|
615
|
+
[isOpen, onSelect]
|
|
616
|
+
);
|
|
609
617
|
const selectAt = useCallback(
|
|
610
618
|
(index) => {
|
|
611
619
|
const option = options[index];
|
|
612
|
-
if (option !== void 0)
|
|
620
|
+
if (option !== void 0) handleSelect(option.value);
|
|
613
621
|
},
|
|
614
|
-
[options,
|
|
622
|
+
[options, handleSelect]
|
|
615
623
|
);
|
|
616
624
|
const selectHighlighted = useCallback(
|
|
617
625
|
() => {
|
|
@@ -644,20 +652,28 @@ var InlineMenu = ({
|
|
|
644
652
|
{
|
|
645
653
|
ref: menuRef,
|
|
646
654
|
accessibilityRole: "menu",
|
|
655
|
+
"aria-hidden": !isOpen,
|
|
647
656
|
"aria-label": accessibilityLabel,
|
|
648
657
|
style: popoverStyle,
|
|
649
658
|
testID: `${testID}-menu`,
|
|
650
|
-
children: /* @__PURE__ */ jsx(
|
|
651
|
-
|
|
659
|
+
children: /* @__PURE__ */ jsx(
|
|
660
|
+
Animated.View,
|
|
652
661
|
{
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
662
|
+
pointerEvents: isOpen ? "auto" : "none",
|
|
663
|
+
style: [styles6.animated, animatedStyle, isOpen ? null : styles6.inert],
|
|
664
|
+
children: /* @__PURE__ */ jsx(ScrollView, { style: styles6.scroll, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsx(
|
|
665
|
+
OptionRow,
|
|
666
|
+
{
|
|
667
|
+
isHighlighted: index === highlightedIndex,
|
|
668
|
+
isSelected: option.value === value,
|
|
669
|
+
label: option.label,
|
|
670
|
+
testID: optionTestID !== void 0 ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`,
|
|
671
|
+
onSelect: () => handleSelect(option.value)
|
|
672
|
+
},
|
|
673
|
+
String(option.value)
|
|
674
|
+
)) })
|
|
675
|
+
}
|
|
676
|
+
)
|
|
661
677
|
}
|
|
662
678
|
);
|
|
663
679
|
if (IS_WEB2) return createPortal(menu, document.body);
|