|
|
@@ -34,6 +34,10 @@ export type OLAutocompleteProps = {
|
|
|
expandUp?: boolean
|
|
|
onClose?: () => void
|
|
|
isOpen?: boolean
|
|
|
+ scrollIntoView?: (
|
|
|
+ node: HTMLElement | null,
|
|
|
+ menuNode: HTMLElement | null
|
|
|
+ ) => void
|
|
|
}
|
|
|
|
|
|
type OLAutocompleteDisplayItem =
|
|
|
@@ -61,6 +65,7 @@ function OLAutocompleteInternal({
|
|
|
expandUp = false,
|
|
|
onClose,
|
|
|
isOpen: controlledIsOpen,
|
|
|
+ scrollIntoView,
|
|
|
}: OLAutocompleteProps) {
|
|
|
const { t } = useTranslation()
|
|
|
|
|
|
@@ -143,6 +148,7 @@ function OLAutocompleteInternal({
|
|
|
items: displayItems,
|
|
|
defaultHighlightedIndex: 0,
|
|
|
...(controlledIsOpen !== undefined && { isOpen: controlledIsOpen }),
|
|
|
+ ...(scrollIntoView !== undefined && { scrollIntoView }),
|
|
|
itemToString: item => {
|
|
|
if (!item) return ''
|
|
|
return item.type === 'create' ? item.inputValue : item.label
|