@dloizides/ui-layout 1.38.0 → 1.38.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 CHANGED
@@ -1,5 +1,11 @@
1
1
  # Changelog
2
2
 
3
+ ## 1.38.2
4
+
5
+ DROPDOWN-WIDTH-1 "A menu opened from a compact trigger is wide enough to read".
6
+
7
+ - `ModalDropdown` with `renderTrigger` and no `menuMinWidth`: the inline menu is now at least 160px wide. An explicit `menuMinWidth` still wins; a default-trigger field keeps its trigger width.
8
+
3
9
  ## 1.37.0
4
10
 
5
11
  INVOICE-FU-9 "INVOICE-5 shared look leftovers", AC-PAGE-1.
package/dist/index.d.mts CHANGED
@@ -385,7 +385,7 @@ interface ModalDropdownProps<T> {
385
385
  * Minimum width of the open inline menu. The menu otherwise matches the TRIGGER's width, which
386
386
  * is right for a full-width field but leaves a COMPACT anchor (a locale pill, an avatar chip, an
387
387
  * icon button — see `renderTrigger`) with a menu too narrow to read its own option labels. It is
388
- * a floor only: a wider trigger still wins. Omit to keep the trigger-width behaviour.
388
+ * a floor only: a wider trigger still wins. Omit: a `renderTrigger` menu floors at 160, a field keeps its width.
389
389
  */
390
390
  menuMinWidth?: number;
391
391
  /**
package/dist/index.d.ts CHANGED
@@ -385,7 +385,7 @@ interface ModalDropdownProps<T> {
385
385
  * Minimum width of the open inline menu. The menu otherwise matches the TRIGGER's width, which
386
386
  * is right for a full-width field but leaves a COMPACT anchor (a locale pill, an avatar chip, an
387
387
  * icon button — see `renderTrigger`) with a menu too narrow to read its own option labels. It is
388
- * a floor only: a wider trigger still wins. Omit to keep the trigger-width behaviour.
388
+ * a floor only: a wider trigger still wins. Omit: a `renderTrigger` menu floors at 160, a field keeps its width.
389
389
  */
390
390
  menuMinWidth?: number;
391
391
  /**
package/dist/index.js CHANGED
@@ -585,9 +585,17 @@ var Modal = ({
585
585
  )
586
586
  ] }) });
587
587
  };
588
+ var CENTRED_ROW = { flexGrow: 1, justifyContent: "center" };
588
589
  var PageOverlay = ({ children, pageSize, visible, onClose, testID }) => {
589
590
  const { t } = uiFeedback.useUi();
590
- return /* @__PURE__ */ jsxRuntime.jsx(Modal, { accessibilityLabel: t(LAYOUT_I18N.pageEnlarge), size: "xl", testID, visible, onClose, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { horizontal: true, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.View, { style: { width: pageSize.width, height: pageSize.height }, testID: `${testID}-page`, children }) }) });
591
+ return /* @__PURE__ */ jsxRuntime.jsx(Modal, { accessibilityLabel: t(LAYOUT_I18N.pageEnlarge), size: "xl", testID, visible, onClose, children: /* @__PURE__ */ jsxRuntime.jsx(reactNative.ScrollView, { horizontal: true, contentContainerStyle: CENTRED_ROW, children: /* @__PURE__ */ jsxRuntime.jsx(
592
+ reactNative.View,
593
+ {
594
+ style: { width: pageSize.width, minWidth: pageSize.width, height: pageSize.height, flexShrink: 0 },
595
+ testID: `${testID}-page`,
596
+ children
597
+ }
598
+ ) }) });
591
599
  };
592
600
 
593
601
  // src/PageFrame/utils/pageScale.ts
@@ -765,6 +773,11 @@ var MENU_PADDING = 4;
765
773
  var MENU_SCROLL_MAX_HEIGHT = MENU_MAX_HEIGHT - (BORDER_WIDTH2 + MENU_PADDING) * 2;
766
774
  var MENU_BOX_SHADOW = "0px 2px 8px rgba(0, 0, 0, 0.15)";
767
775
  var MENU_VIEWPORT_MARGIN = 8;
776
+ var COMPACT_TRIGGER_MENU_MIN_WIDTH = 160;
777
+ function resolveMenuMinWidth(menuMinWidth, hasCustomTrigger) {
778
+ if (menuMinWidth !== void 0) return menuMinWidth;
779
+ return hasCustomTrigger ? COMPACT_TRIGGER_MENU_MIN_WIDTH : void 0;
780
+ }
768
781
  function buildPortalPopoverStyle(rect, minWidth = 0, viewportWidth = 0) {
769
782
  const width = Math.max(rect.width, minWidth);
770
783
  let left = rect.left;
@@ -1395,7 +1408,7 @@ var ModalDropdown = ({
1395
1408
  containerRef: anchorRef,
1396
1409
  isOpen,
1397
1410
  menuHeading,
1398
- menuMinWidth,
1411
+ menuMinWidth: resolveMenuMinWidth(menuMinWidth, renderTrigger !== void 0),
1399
1412
  optionTestID: optionTestIDFor,
1400
1413
  options,
1401
1414
  selectedMarker,