feat(collections): virtual row layout with variable heights, headings, loader and gap/padding
ListBox virtualized mode grows a full row stream (padding spacers, data-driven heading rows, item rows, #loader row) with px semantics mapped from the pinned ListLayout contract: rowHeight may be a per-index function falling back to estimatedRowHeight, gap sits between content rows only, padding is end spacers, and every input is re-read per layout pass. Scroll ownership resolves to the list root or the nearest scrolling ancestor so popovers scroll as a whole with a sticky search field (data-virtualized hook; the historical 320px self-scroll rule stays for non-virtualized lists). Table gains the public useVirtualRows/bindVirtualRows pure geometry helpers (prefix sums + binary search, no state kernel): variable heights, estimated fallback, gap/padding and a loader reservation that stays consistent with the rendered spacers. headingHeight and dropIndicatorThickness remain unavailable (no sectioned header model, no drag-and-drop) and are recorded as such. Pinned demo values stay explicit (table 42px, list-box/autocomplete 50px); the table demo scrolls an outer viewport div because a native table cannot be a scroll container (verified: 300px height blown out to 45036px).
This commit is contained in:
@@ -200,10 +200,24 @@
|
||||
* popover itself is constrained (e.g. inside a Modal, or a short viewport). Without
|
||||
* it the list keeps its full 320px and its overflow is clipped by the popover, making
|
||||
* the last options unreachable. */
|
||||
[data-slot="list-box"] {
|
||||
[data-slot="list-box"]:not([data-virtualized]) {
|
||||
@apply max-h-[320px] min-h-0 scrollbar overflow-y-auto p-1.5 outline-none;
|
||||
}
|
||||
|
||||
/* Virtualized lists scroll the popover content as a whole (the pinned
|
||||
* upstream layout): the row window binds to this scrolling ancestor and the
|
||||
* search field can stay sticky at its top. The height cap stands in for the
|
||||
* upstream overlay's available-space clamp. */
|
||||
&:has([data-slot="list-box"][data-virtualized]) [data-slot="autocomplete-filter"] {
|
||||
@apply max-h-[min(400px,70vh)] overflow-y-auto;
|
||||
}
|
||||
|
||||
[data-slot="list-box"][data-virtualized] {
|
||||
@apply min-h-0 p-1.5 outline-none;
|
||||
max-height: none;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
[data-slot="list-box-item"] {
|
||||
@apply px-2.5;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user