@dloizides/ui-layout 1.38.1 → 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
@@ -773,6 +773,11 @@ var MENU_PADDING = 4;
773
773
  var MENU_SCROLL_MAX_HEIGHT = MENU_MAX_HEIGHT - (BORDER_WIDTH2 + MENU_PADDING) * 2;
774
774
  var MENU_BOX_SHADOW = "0px 2px 8px rgba(0, 0, 0, 0.15)";
775
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
+ }
776
781
  function buildPortalPopoverStyle(rect, minWidth = 0, viewportWidth = 0) {
777
782
  const width = Math.max(rect.width, minWidth);
778
783
  let left = rect.left;
@@ -1403,7 +1408,7 @@ var ModalDropdown = ({
1403
1408
  containerRef: anchorRef,
1404
1409
  isOpen,
1405
1410
  menuHeading,
1406
- menuMinWidth,
1411
+ menuMinWidth: resolveMenuMinWidth(menuMinWidth, renderTrigger !== void 0),
1407
1412
  optionTestID: optionTestIDFor,
1408
1413
  options,
1409
1414
  selectedMarker,