PdfSearchBar

fun PdfSearchBar(query: String, onQueryChange: (String) -> Unit, matchCount: Int, activeIndex: Int, onPrevious: () -> Unit, onNext: () -> Unit, onClose: () -> Unit, modifier: Modifier = Modifier, placeholder: String = "Search in document")

Inline search field that morphs into the place of PdfViewerTopBar while the user is searching the document. Mirrors the handoff's "Topbar → search transition" behaviour: same height as the parent topbar, white background, divider underneath, focus-on-mount, with prev / next / close affordances and a live match counter.

Drive it from the host: own a query: String and activeIndex: Int, compute matches via searchPdfText, pass them to PdfViewer's searchHighlights parameter, and update activeIndex on onPrevious / onNext. Closing the bar (back arrow tap or IME Done) should clear the query and dismiss the search state on the host side via onClose.

Parameters

query

current search string.

onQueryChange

called whenever the user edits the input.

matchCount

total number of matches across the document.

activeIndex

zero-based index of the currently focused match inside the match list. -1 when nothing is active (empty query or no matches).

onPrevious

previous-match tap. Should set activeIndex to (activeIndex - 1 + matchCount) % matchCount.

onNext

next-match tap. Should set activeIndex to (activeIndex + 1) % matchCount.

onClose

close-the-bar tap. Should reset query to "" and dismiss the search state on the host so PdfViewerTopBar returns.

modifier

applied to the outer container.

placeholder

prompt rendered while the input is empty.