import { BoxProps, ElementProps, Factory, StylesApiProps } from '../../core'; import { ComboboxProps } from '../Combobox'; import { __BaseInputProps, __InputStylesNames } from '../Input'; import { Mention, MentionProps } from './Mention'; import type { MentionOccurrence, MentionsChangePayload, MentionsFilter, MentionsRenderMentionInput } from './Mentions.types'; export type MentionsStylesNames = __InputStylesNames | 'field' | 'highlighter' | 'highlight' | 'dropdown' | 'options' | 'option' | 'nothingFound' | 'inlineSuggestion' | 'inlineSuggestionPrefix' | 'inlineSuggestionText'; export type MentionsCssVariables = { highlight: '--mentions-highlight-color' | '--mentions-highlight-bg'; }; export interface MentionsProps extends BoxProps, __BaseInputProps, StylesApiProps, ElementProps<'textarea', 'onChange' | 'value' | 'defaultValue' | 'size'> { /** Controlled markup value, `\r\n` line breaks are normalized to `\n` */ value?: string; /** Uncontrolled markup value initial state, `\r\n` line breaks are normalized to `\n` */ defaultValue?: string; /** Called on every value change with a rich payload */ onChange?: (payload: MentionsChangePayload) => void; /** `Mentions.Mention` nodes, one per trigger/data source */ children?: React.ReactNode; /** If set, renders a single-line `input` instead of a `textarea` @default false */ singleLine?: boolean; /** Minimum rows of the underlying control */ minRows?: number; /** Maximum rows before the control scrolls */ maxRows?: number; /** Anchors the dropdown to the caret position or the input's left edge @default 'caret' */ anchorMode?: 'caret' | 'left'; /** Dropdown placement relative to the anchor @default 'below' */ suggestionsPlacement?: 'auto' | 'above' | 'below'; /** Displays suggestions as a dropdown list or as inline ghost text @default 'overlay' */ suggestionsDisplay?: 'overlay' | 'inline'; /** Called whenever the caret or selection changes (including after edits), with the mentions it overlaps (empty array when none) */ onSelectionChange?: (selection: { start: number; end: number; }, mentions: MentionOccurrence[]) => void; /** Local filtering of array data, `false` to disable (server-driven) */ filter?: false | MentionsFilter; /** Message shown when a query returns no matches */ nothingFoundMessage?: React.ReactNode; /** Message shown while an async `data` function is pending @default 'Loading…' */ loadingMessage?: React.ReactNode; /** Message shown when an async `data` function rejects, `renderError` of `Mentions.Mention` takes precedence @default 'Failed to load suggestions' */ errorMessage?: React.ReactNode; /** Function to customize how mentions are rendered in the overlay, for example to add a tooltip or a `HoverCard`. The returned content must keep the same text metrics as `display` to stay aligned. */ renderMention?: (input: MentionsRenderMentionInput) => React.ReactNode; /** Dropdown `max-height` before scroll @default 220 */ maxDropdownHeight?: number | string; /** Props passed down to the underlying `Combobox` */ comboboxProps?: ComboboxProps; /** Screen-reader label for the suggestions list @default 'Suggestions' */ a11ySuggestionsListLabel?: string; /** `static` disables all interactions @default 'interactive' */ mode?: 'interactive' | 'static'; } export type MentionsFactory = Factory<{ props: MentionsProps; ref: HTMLTextAreaElement | HTMLInputElement; stylesNames: MentionsStylesNames; vars: MentionsCssVariables; staticComponents: { Mention: typeof Mention; }; }>; export declare const Mentions: import("../..").MantineComponent<{ props: MentionsProps; ref: HTMLTextAreaElement | HTMLInputElement; stylesNames: MentionsStylesNames; vars: MentionsCssVariables; staticComponents: { Mention: typeof Mention; }; }>; export declare namespace Mentions { type Props = MentionsProps; type StylesNames = MentionsStylesNames; type CssVariables = MentionsCssVariables; type Factory = MentionsFactory; namespace Mention { type Props = MentionProps; } }