@dloizides/ui-layout 1.26.2 → 1.26.4

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/dist/index.mjs CHANGED
@@ -138,11 +138,14 @@ var styles3 = StyleSheet.create({
138
138
  paddingHorizontal: DEFAULT_PADDING_H,
139
139
  paddingVertical: DEFAULT_PADDING_V,
140
140
  borderRadius: DEFAULT_BORDER_RADIUS,
141
- alignSelf: "flex-start"
141
+ alignSelf: "flex-start",
142
+ // Never wider than the container: a long label wraps inside the pill instead of being clipped.
143
+ maxWidth: "100%"
142
144
  },
143
145
  text: {
144
146
  fontSize: DEFAULT_FONT_SIZE,
145
- fontWeight: "600"
147
+ fontWeight: "600",
148
+ flexShrink: 1
146
149
  }
147
150
  });
148
151
  var StatusBadge = ({
@@ -580,6 +583,8 @@ var styles6 = StyleSheet.create({
580
583
  // node (the `menuRef` outside-click / keyboard logic and the web portal target depend on it).
581
584
  // `transformOrigin: 'top'` makes the scale grow downward FROM the anchor rather than the centre.
582
585
  animated: { transformOrigin: "top" },
586
+ // Exit fade only: the dying popover must not receive the next click. See the file header.
587
+ inert: { pointerEvents: "none" },
583
588
  // Bound the scroll viewport so a list longer than the popover scrolls (with a scrollbar) instead of
584
589
  // overflowing the frame — the popover's own maxHeight cannot do this (see MENU_SCROLL_MAX_HEIGHT).
585
590
  scroll: { maxHeight: MENU_SCROLL_MAX_HEIGHT }
@@ -606,12 +611,18 @@ var InlineMenu = ({
606
611
  [options, value]
607
612
  );
608
613
  const [highlightedIndex, setHighlightedIndex] = useState(() => selectedIndex);
614
+ const handleSelect = useCallback(
615
+ (optionValue) => {
616
+ if (isOpen) onSelect(optionValue);
617
+ },
618
+ [isOpen, onSelect]
619
+ );
609
620
  const selectAt = useCallback(
610
621
  (index) => {
611
622
  const option = options[index];
612
- if (option !== void 0) onSelect(option.value);
623
+ if (option !== void 0) handleSelect(option.value);
613
624
  },
614
- [options, onSelect]
625
+ [options, handleSelect]
615
626
  );
616
627
  const selectHighlighted = useCallback(
617
628
  () => {
@@ -644,20 +655,28 @@ var InlineMenu = ({
644
655
  {
645
656
  ref: menuRef,
646
657
  accessibilityRole: "menu",
658
+ "aria-hidden": !isOpen,
647
659
  "aria-label": accessibilityLabel,
648
660
  style: popoverStyle,
649
661
  testID: `${testID}-menu`,
650
- children: /* @__PURE__ */ jsx(Animated.View, { style: [styles6.animated, animatedStyle], children: /* @__PURE__ */ jsx(ScrollView, { style: styles6.scroll, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsx(
651
- OptionRow,
662
+ children: /* @__PURE__ */ jsx(
663
+ Animated.View,
652
664
  {
653
- isHighlighted: index === highlightedIndex,
654
- isSelected: option.value === value,
655
- label: option.label,
656
- testID: optionTestID !== void 0 ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`,
657
- onSelect: () => onSelect(option.value)
658
- },
659
- String(option.value)
660
- )) }) })
665
+ pointerEvents: isOpen ? "auto" : "none",
666
+ style: [styles6.animated, animatedStyle, isOpen ? null : styles6.inert],
667
+ children: /* @__PURE__ */ jsx(ScrollView, { style: styles6.scroll, keyboardShouldPersistTaps: "handled", children: options.map((option, index) => /* @__PURE__ */ jsx(
668
+ OptionRow,
669
+ {
670
+ isHighlighted: index === highlightedIndex,
671
+ isSelected: option.value === value,
672
+ label: option.label,
673
+ testID: optionTestID !== void 0 ? optionTestID(option.value) : `${testID}-option-${String(option.value)}`,
674
+ onSelect: () => handleSelect(option.value)
675
+ },
676
+ String(option.value)
677
+ )) })
678
+ }
679
+ )
661
680
  }
662
681
  );
663
682
  if (IS_WEB2) return createPortal(menu, document.body);