@lavalogic/scoria 0.37.40 → 0.37.41

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.
@@ -133,8 +133,8 @@ div.content {
133
133
  }
134
134
  div.content {
135
135
  max-height: var(--card-max-height, 100%);
136
- overflow: auto;
137
- height: var(--card-max-height);
136
+ height: max-content;
137
+ min-height: 0;
138
138
  opacity: 1;
139
139
  width: 100%;
140
140
  }
@@ -56,6 +56,15 @@ const PORTAL_Z_INDEX = 99998;
56
56
  * inside their fixed-height box.
57
57
  */
58
58
  const FLIP_THRESHOLD_PX = 240;
59
+ /**
60
+ * Hard cap on the dropdown's open height, regardless of how much
61
+ * vertical space the trigger leaves between itself and the viewport
62
+ * edge. Matches Svelecte's own `--sv-dropdown-height` default (320px)
63
+ * so a typical dropdown opens at a sensible "six rows plus search
64
+ * input" size and only shrinks below that when the trigger is genuinely
65
+ * close to the viewport edge.
66
+ */
67
+ const MAX_DROPDOWN_HEIGHT_PX = 320;
59
68
  /** Run a function on the next animation frame, coalescing repeat
60
69
  * calls so we don't queue dozens of layout reads per scroll burst. */
61
70
  function rafThrottle(fn) {
@@ -116,9 +125,16 @@ export function attachDropdownPortal(options) {
116
125
  dropdown.style.minWidth = `${tr.width}px`;
117
126
  dropdown.style.maxWidth = `${tr.width}px`;
118
127
  dropdown.style.zIndex = String(PORTAL_Z_INDEX);
128
+ // Cap the dropdown height at `MAX_DROPDOWN_HEIGHT_PX` regardless
129
+ // of how much space the trigger has below / above it - we never
130
+ // want the dropdown to be as tall as the viewport just because
131
+ // the option list could fit. The `Math.max(..., 64)` floor
132
+ // stops the dropdown from collapsing to a single-row sliver
133
+ // when the trigger is genuinely pinned against the viewport
134
+ // edge; the inner scroll handles the rest.
119
135
  const availableHeightPx = openUp
120
- ? Math.max(spaceAbove - 8, 64)
121
- : Math.max(spaceBelow - 8, 64);
136
+ ? Math.min(MAX_DROPDOWN_HEIGHT_PX, Math.max(spaceAbove - 8, 64))
137
+ : Math.min(MAX_DROPDOWN_HEIGHT_PX, Math.max(spaceBelow - 8, 64));
122
138
  if (openUp) {
123
139
  dropdown.style.top = '';
124
140
  dropdown.style.bottom = `${viewportHeight - tr.top}px`;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@lavalogic/scoria",
3
3
  "description": "Svelte components used for the FloWMS Web Frontend",
4
- "version": "0.37.40",
4
+ "version": "0.37.41",
5
5
  "publishConfig": {
6
6
  "access": "restricted"
7
7
  },