/** * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * */ import { type CommandListenerPriority, type TextNode } from 'lexical'; import { type JSX } from 'react'; import { MenuOption, type MenuRenderFn, type MenuResolution, type MenuTextMatch, type TriggerFn } from './shared/LexicalMenu.js'; export { useDynamicPositioning } from './shared/LexicalMenu.js'; export { getScrollParent, PUNCTUATION, SCROLL_TYPEAHEAD_OPTION_INTO_VIEW_COMMAND, useBasicTypeaheadTriggerMatch, } from '@lexical/react/LexicalTypeaheadMenuPluginUtils'; /** * Props for the {@link LexicalTypeaheadMenuPlugin} component. */ export type TypeaheadMenuPluginProps = { onQueryChange: (matchingString: string | null) => void; onSelectOption: (option: TOption, textNodeContainingQuery: TextNode | null, closeMenu: () => void, matchingString: string) => void; options: TOption[]; triggerFn: TriggerFn; menuRenderFn?: MenuRenderFn; onOpen?: (resolution: MenuResolution) => void; onClose?: () => void | PromiseLike; anchorClassName?: string; commandPriority?: CommandListenerPriority; parent?: HTMLElement; preselectFirstItem?: boolean; ignoreEntityBoundary?: boolean; }; /** * Renders a floating menu (such as an `@`-mention or slash-command picker) while * the text before the cursor matches `triggerFn`. As the user types, the * current query is reported via `onQueryChange`; supply the `options` to show * and an `onSelectOption` handler to apply the chosen option. Use * {@link useBasicTypeaheadTriggerMatch} to build a simple `triggerFn`. * * @returns The floating menu element, or `null` when no query is active. */ export declare function LexicalTypeaheadMenuPlugin({ options, onQueryChange, onSelectOption, onOpen, onClose, menuRenderFn, triggerFn, anchorClassName, commandPriority, parent, preselectFirstItem, ignoreEntityBoundary, }: TypeaheadMenuPluginProps): JSX.Element | null; export { MenuOption, MenuRenderFn, MenuResolution, MenuTextMatch, TriggerFn };