{"version":3,"file":"Mentions.mjs","names":["useId","classes"],"sources":["../../../src/components/Mentions/Mentions.tsx"],"sourcesContent":["import { useMemo, useRef, useState } from 'react';\nimport { useId, useMergedRef } from '@mantine/hooks';\nimport {\n  BoxProps,\n  createVarsResolver,\n  ElementProps,\n  extractStyleProps,\n  factory,\n  Factory,\n  StylesApiProps,\n  useProps,\n  useResolvedStylesApi,\n  useStyles,\n} from '../../core';\nimport { Combobox, ComboboxProps, useCombobox } from '../Combobox';\nimport { __BaseInputProps, __InputStylesNames } from '../Input';\nimport { InputBase } from '../InputBase';\nimport { detectQuery, isQueryInText, type ActiveMentionQuery } from './detect-query';\nimport { buildHighlightSegments } from './highlight-segments';\nimport { Mention, MentionProps } from './Mention';\nimport type {\n  MentionOccurrence,\n  MentionsChangePayload,\n  MentionsChangeReason,\n  MentionsFilter,\n  MentionsRenderMentionInput,\n} from './Mentions.types';\nimport { MentionsControl } from './MentionsControl';\nimport { MentionsDropdown } from './MentionsDropdown';\nimport { MentionsHighlighter } from './MentionsHighlighter';\nimport { MentionsInlineSuggestion } from './MentionsInlineSuggestion';\nimport { resolveSources } from './resolve-sources';\nimport { splitWrapperProps } from './split-wrapper-props';\nimport { useMentionsClipboard } from './use-mentions-clipboard';\nimport { useMentionsDropdown } from './use-mentions-dropdown';\nimport { useMentionsInlineSuggestion } from './use-mentions-inline-suggestion';\nimport { useMentionsOverlayPosition } from './use-mentions-overlay-position';\nimport { useMentionsQuery } from './use-mentions-query';\nimport { useMentionsSelection } from './use-mentions-selection';\nimport { useMentionsValue } from './use-mentions-value';\nimport { applyChangeToValue } from './utils/apply-change-to-value';\nimport { getInputChangeType } from './utils/get-input-change-type';\nimport { insertMention } from './utils/insert-mention';\nimport { normalizeNewlines } from './utils/normalize-newlines';\nimport { getSelectionStates } from './utils/selection';\nimport type { MentionWalk } from './utils/walk-mentions';\nimport classes from './Mentions.module.css';\n\nexport type MentionsStylesNames =\n  | __InputStylesNames\n  | 'field'\n  | 'highlighter'\n  | 'highlight'\n  | 'dropdown'\n  | 'options'\n  | 'option'\n  | 'nothingFound'\n  | 'inlineSuggestion'\n  | 'inlineSuggestionPrefix'\n  | 'inlineSuggestionText';\n\nexport type MentionsCssVariables = {\n  highlight: '--mentions-highlight-color' | '--mentions-highlight-bg';\n};\n\nexport interface MentionsProps\n  extends\n    BoxProps,\n    __BaseInputProps,\n    StylesApiProps<MentionsFactory>,\n    ElementProps<'textarea', 'onChange' | 'value' | 'defaultValue' | 'size'> {\n  /** Controlled markup value, `\\r\\n` line breaks are normalized to `\\n` */\n  value?: string;\n\n  /** Uncontrolled markup value initial state, `\\r\\n` line breaks are normalized to `\\n` */\n  defaultValue?: string;\n\n  /** Called on every value change with a rich payload */\n  onChange?: (payload: MentionsChangePayload) => void;\n\n  /** `Mentions.Mention` nodes, one per trigger/data source */\n  children?: React.ReactNode;\n\n  /** If set, renders a single-line `input` instead of a `textarea` @default false */\n  singleLine?: boolean;\n\n  /** Minimum rows of the underlying control */\n  minRows?: number;\n\n  /** Maximum rows before the control scrolls */\n  maxRows?: number;\n\n  /** Anchors the dropdown to the caret position or the input's left edge @default 'caret' */\n  anchorMode?: 'caret' | 'left';\n\n  /** Dropdown placement relative to the anchor @default 'below' */\n  suggestionsPlacement?: 'auto' | 'above' | 'below';\n\n  /** Displays suggestions as a dropdown list or as inline ghost text @default 'overlay' */\n  suggestionsDisplay?: 'overlay' | 'inline';\n\n  /** Called whenever the caret or selection changes (including after edits), with the mentions it overlaps (empty array when none) */\n  onSelectionChange?: (\n    selection: { start: number; end: number },\n    mentions: MentionOccurrence[]\n  ) => void;\n\n  /** Local filtering of array data, `false` to disable (server-driven) */\n  filter?: false | MentionsFilter;\n\n  /** Message shown when a query returns no matches */\n  nothingFoundMessage?: React.ReactNode;\n\n  /** Message shown while an async `data` function is pending @default 'Loading…' */\n  loadingMessage?: React.ReactNode;\n\n  /** Message shown when an async `data` function rejects, `renderError` of `Mentions.Mention` takes precedence @default 'Failed to load suggestions' */\n  errorMessage?: React.ReactNode;\n\n  /** 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. */\n  renderMention?: (input: MentionsRenderMentionInput) => React.ReactNode;\n\n  /** Dropdown `max-height` before scroll @default 220 */\n  maxDropdownHeight?: number | string;\n\n  /** Props passed down to the underlying `Combobox` */\n  comboboxProps?: ComboboxProps;\n\n  /** Screen-reader label for the suggestions list @default 'Suggestions' */\n  a11ySuggestionsListLabel?: string;\n\n  /** `static` disables all interactions @default 'interactive' */\n  mode?: 'interactive' | 'static';\n}\n\nexport type MentionsFactory = Factory<{\n  props: MentionsProps;\n  ref: HTMLTextAreaElement | HTMLInputElement;\n  stylesNames: MentionsStylesNames;\n  vars: MentionsCssVariables;\n  staticComponents: {\n    Mention: typeof Mention;\n  };\n}>;\n\nconst defaultProps = {\n  singleLine: false,\n  anchorMode: 'caret',\n  suggestionsPlacement: 'below',\n  suggestionsDisplay: 'overlay',\n  spellCheck: false,\n  mode: 'interactive',\n  size: 'sm',\n  loadingMessage: 'Loading…',\n  errorMessage: 'Failed to load suggestions',\n  a11ySuggestionsListLabel: 'Suggestions',\n} satisfies Partial<MentionsProps>;\n\nconst varsResolver = createVarsResolver<MentionsFactory>(() => ({\n  highlight: {\n    '--mentions-highlight-color': undefined,\n    '--mentions-highlight-bg': undefined,\n  },\n}));\n\nfunction isComposingEvent(event: React.KeyboardEvent) {\n  return event.nativeEvent.isComposing || event.keyCode === 229;\n}\n\nexport const Mentions = factory<MentionsFactory>((_props) => {\n  const props = useProps('Mentions', defaultProps, _props);\n  const {\n    classNames,\n    styles,\n    unstyled,\n    className,\n    style,\n    vars,\n    value,\n    defaultValue,\n    onChange,\n    children,\n    singleLine,\n    minRows,\n    maxRows,\n    anchorMode,\n    suggestionsPlacement,\n    suggestionsDisplay,\n    onSelectionChange,\n    filter,\n    nothingFoundMessage,\n    loadingMessage,\n    errorMessage,\n    renderMention,\n    maxDropdownHeight,\n    comboboxProps,\n    a11ySuggestionsListLabel,\n    mode,\n    size,\n    id,\n    disabled,\n    readOnly,\n    required,\n    attributes,\n    ref,\n    name,\n    form,\n    onKeyDown,\n    onBlur,\n    onClick,\n    onSelect,\n    onScroll,\n    onCopy,\n    onCut,\n    onPaste,\n    onCompositionStart,\n    onCompositionEnd,\n    ...others\n  } = props;\n\n  const { styleProps, rest } = extractStyleProps(others);\n  const { wrapperProps, controlProps } = splitWrapperProps(rest);\n\n  const _id = useId(id);\n  const optionIdPrefix = useId();\n  const interactive = mode === 'interactive' && !disabled && !readOnly;\n\n  const sources = useMemo(() => resolveSources(children), [children]);\n  const configs = useMemo(() => sources.map((source) => source.config), [sources]);\n\n  const controlRef = useRef<HTMLTextAreaElement | HTMLInputElement>(null);\n  const highlighterRef = useRef<HTMLDivElement>(null);\n  const inlineSuggestionRef = useRef<HTMLDivElement>(null);\n  const mergedRef = useMergedRef(controlRef, ref);\n\n  const [proposedQuery, setQuery] = useState<ActiveMentionQuery | null>(null);\n\n  const combobox = useCombobox({\n    onDropdownClose: () => combobox.resetSelectedOption(),\n  });\n\n  const selectionApi = useMentionsSelection({\n    controlRef,\n    onSelectionChange,\n    onCompositionStart,\n    onCompositionEnd,\n  });\n  const { selection, selectionRef, setCaret, readLiveSelection } = selectionApi;\n\n  const { walk, applyEdit, undo, redo } = useMentionsValue({\n    value,\n    defaultValue,\n    onChange,\n    singleLine,\n    configs,\n    setCaret,\n  });\n  const { plainText } = walk;\n  const selectionStates = getSelectionStates(walk.spans, selection.start, selection.end);\n  const segments = buildHighlightSegments(plainText, walk.spans, sources, selectionStates);\n  const query =\n    proposedQuery && isQueryInText(proposedQuery, plainText, sources, walk.spans)\n      ? proposedQuery\n      : null;\n\n  const activeSource = query ? sources[query.sourceIndex] : null;\n  const queryState = useMentionsQuery({\n    source: activeSource,\n    query: query?.query ?? null,\n    enabled: interactive,\n    filter,\n  });\n  const suggestions = queryState.items;\n\n  const hasOptions = suggestions.length > 0;\n  const shouldOpenDropdown =\n    interactive &&\n    suggestionsDisplay === 'overlay' &&\n    query != null &&\n    (queryState.loading ||\n      !!queryState.error ||\n      hasOptions ||\n      !!nothingFoundMessage ||\n      !!activeSource?.props.renderEmpty);\n\n  const { selectedOptionId, selectNext, selectPrevious, activeDescendant } = useMentionsDropdown({\n    combobox,\n    shouldOpen: shouldOpenDropdown,\n    hasOptions,\n    optionsKey: `${query?.sourceIndex}\\u0000${query?.query}\\u0000${queryState.generation}\\u0000${suggestions.map((item) => item.id).join('\\u0000')}`,\n  });\n\n  const getStyles = useStyles<MentionsFactory>({\n    name: 'Mentions',\n    classes,\n    props,\n    classNames,\n    styles,\n    unstyled,\n    attributes,\n    vars,\n    varsResolver,\n  });\n\n  const { resolvedClassNames, resolvedStyles } = useResolvedStylesApi<MentionsFactory>({\n    props,\n    styles,\n    classNames,\n  });\n\n  const updateActiveQuery = (nextWalk: MentionWalk, caret: number) => {\n    setQuery(interactive ? detectQuery(nextWalk.plainText, caret, sources, nextWalk.spans) : null);\n  };\n\n  const commitEdit = (\n    nextValue: string,\n    caret: number,\n    caretBefore: number,\n    reason: MentionsChangeReason\n  ) => {\n    updateActiveQuery(applyEdit(nextValue, caret, caretBefore, reason), caret);\n  };\n\n  const syncSelectionAndQuery = (target: HTMLTextAreaElement | HTMLInputElement) => {\n    const { start, end } = selectionApi.syncSelection(target, walk);\n    if (start === end) {\n      updateActiveQuery(walk, start);\n    } else {\n      setQuery(null);\n    }\n  };\n\n  const handleChange = (event: React.ChangeEvent<HTMLTextAreaElement>) => {\n    const target = event.currentTarget;\n    const nextPlainText = normalizeNewlines(target.value, singleLine);\n    const caretAfter = target.selectionStart ?? nextPlainText.length;\n    const before = selectionRef.current;\n\n    const result = applyChangeToValue(\n      walk,\n      nextPlainText,\n      {\n        selectionStartBefore: before.start,\n        selectionEndBefore: before.end,\n        selectionEndAfter: caretAfter,\n      },\n      configs\n    );\n\n    commitEdit(result.value, result.caretPlainTextIndex, before.end, {\n      type: getInputChangeType(event.nativeEvent, result.removedMention),\n      nativeEvent: event.nativeEvent,\n    });\n  };\n\n  const handleOptionSubmit = (id: string) => {\n    const item = suggestions.find((suggestion) => suggestion.id === id);\n    if (!activeSource || !query || !item) {\n      return;\n    }\n\n    const display = item.display ?? item.id;\n    const insertion = insertMention({\n      walk,\n      config: activeSource.config,\n      queryStart: query.queryStart,\n      queryEnd: query.queryEnd,\n      id: item.id,\n      display,\n      appendSpace: activeSource.props.appendSpaceOnAdd ?? false,\n    });\n\n    applyEdit(insertion.value, insertion.caret, query.queryEnd, { type: 'mention-add' }, item.id);\n    setQuery(null);\n    activeSource.props.onAdd?.({\n      id: item.id,\n      display,\n      startPos: query.queryStart,\n      endPos: query.queryEnd,\n    });\n  };\n\n  const inline = useMentionsInlineSuggestion({\n    enabled: suggestionsDisplay === 'inline',\n    query,\n    queryState,\n    ignoreAccents: activeSource?.props.ignoreAccents,\n    selection,\n    plainText,\n    onAccept: handleOptionSubmit,\n  });\n\n  const clipboardHandlers = useMentionsClipboard({\n    walk,\n    configs,\n    singleLine,\n    interactive,\n    readLiveSelection,\n    commitEdit,\n    onCopy,\n    onCut,\n    onPaste,\n  });\n\n  const { caretStyle, handleScroll } = useMentionsOverlayPosition({\n    controlRef,\n    overlayRefs: [highlighterRef, inlineSuggestionRef],\n    anchorMode,\n    query,\n    singleLine,\n    value: walk.value,\n  });\n\n  /** Keyboard handling is not delegated to `Combobox.EventsTarget` because arrows and Enter must keep their textarea behavior while the dropdown is closed */\n  const handleKeyDown = (event: React.KeyboardEvent<HTMLTextAreaElement>) => {\n    onKeyDown?.(event);\n    readLiveSelection(event.currentTarget);\n\n    if (event.defaultPrevented || !interactive || isComposingEvent(event)) {\n      return;\n    }\n\n    if (event.metaKey || event.ctrlKey) {\n      const key = event.key.toLowerCase();\n      if (key === 'z' || key === 'y') {\n        const type = key === 'y' || event.shiftKey ? 'redo' : 'undo';\n        const entry = type === 'redo' ? redo() : undo();\n        if (entry) {\n          event.preventDefault();\n          commitEdit(entry.value, entry.caret, entry.caret, { type });\n        }\n        return;\n      }\n    }\n\n    if (suggestionsDisplay === 'inline') {\n      inline.handleInlineKeyDown(event);\n      return;\n    }\n\n    if (!combobox.dropdownOpened) {\n      return;\n    }\n\n    if (event.key === 'ArrowDown' || event.key === 'ArrowUp') {\n      event.preventDefault();\n      if (event.key === 'ArrowDown') {\n        selectNext();\n      } else {\n        selectPrevious();\n      }\n    } else if (\n      (event.key === 'Enter' || (event.key === 'Tab' && !event.shiftKey)) &&\n      combobox.getSelectedOptionIndex() !== -1\n    ) {\n      event.preventDefault();\n      combobox.clickSelectedOption();\n    } else if (event.key === 'Escape') {\n      event.preventDefault();\n      combobox.closeDropdown();\n      setQuery(null);\n    }\n  };\n\n  const handleMentionPress = (caret: number) => {\n    const control = controlRef.current;\n    if (!control) {\n      return;\n    }\n\n    control.focus();\n    control.setSelectionRange(caret, caret);\n    syncSelectionAndQuery(control);\n  };\n\n  const field = (\n    <InputBase\n      component=\"div\"\n      multiline\n      data-no-overflow\n      withAria={false}\n      __staticSelector=\"Mentions\"\n      __stylesApiProps={singleLine ? props : { ...props, multiline: true }}\n      classNames={resolvedClassNames}\n      styles={resolvedStyles}\n      unstyled={unstyled}\n      className={className}\n      style={style}\n      size={size}\n      id={_id}\n      disabled={disabled}\n      required={required}\n      attributes={attributes}\n      {...wrapperProps}\n      pointer={wrapperProps.pointer ?? false}\n      onMouseDown={(event: React.MouseEvent<HTMLDivElement>) => {\n        if (event.target === event.currentTarget) {\n          event.preventDefault();\n          controlRef.current?.focus();\n        }\n      }}\n      {...styleProps}\n    >\n      <div\n        className={classes.control}\n        data-single-line={singleLine || undefined}\n        style={\n          {\n            '--mentions-min-rows': minRows ?? 1,\n            '--mentions-max-rows': maxRows,\n          } as React.CSSProperties\n        }\n      >\n        <MentionsHighlighter\n          ref={highlighterRef}\n          getStyles={getStyles}\n          segments={segments}\n          trailingNewline={plainText.endsWith('\\n')}\n          renderMention={renderMention}\n          onMentionPress={interactive ? handleMentionPress : undefined}\n        />\n\n        <MentionsControl\n          form={form}\n          aria-invalid={wrapperProps.error ? true : undefined}\n          {...controlProps}\n          {...getStyles('field')}\n          {...clipboardHandlers}\n          {...selectionApi.compositionHandlers}\n          singleLine={singleLine}\n          controlRef={mergedRef}\n          value={plainText}\n          disabled={disabled}\n          required={required}\n          readOnly={readOnly || mode === 'static'}\n          rows={singleLine ? undefined : (minRows ?? 1)}\n          interactive={interactive}\n          dropdownOpened={combobox.dropdownOpened}\n          listId={combobox.listId}\n          activeDescendant={activeDescendant}\n          popupVisible={!!inline.inlineItem}\n          onChange={handleChange}\n          onKeyDown={handleKeyDown}\n          onSelect={(event: React.SyntheticEvent<HTMLTextAreaElement>) => {\n            onSelect?.(event);\n            if (!selectionApi.isCaretRestorePending()) {\n              syncSelectionAndQuery(event.currentTarget);\n            }\n          }}\n          onBlur={(event: React.FocusEvent<HTMLTextAreaElement>) => {\n            onBlur?.(event);\n            setQuery(null);\n          }}\n          onClick={(event: React.MouseEvent<HTMLTextAreaElement>) => {\n            onClick?.(event);\n            syncSelectionAndQuery(event.currentTarget);\n          }}\n          onScroll={(event: React.UIEvent<HTMLTextAreaElement>) => {\n            onScroll?.(event);\n            handleScroll();\n          }}\n        />\n\n        {inline.inlineItem && query ? (\n          <MentionsInlineSuggestion\n            ref={inlineSuggestionRef}\n            getStyles={getStyles}\n            prefix={plainText.slice(0, query.queryEnd)}\n            completion={inline.inlineCompletion}\n          />\n        ) : null}\n\n        {anchorMode === 'caret' ? (\n          <Combobox.DropdownTarget>\n            <div\n              className={classes.caretAnchor}\n              style={caretStyle ?? { top: 0, left: 0 }}\n              aria-hidden\n            />\n          </Combobox.DropdownTarget>\n        ) : null}\n      </div>\n    </InputBase>\n  );\n\n  return (\n    <Combobox\n      store={combobox}\n      __staticSelector=\"Mentions\"\n      classNames={resolvedClassNames}\n      styles={resolvedStyles}\n      unstyled={unstyled}\n      size={size}\n      readOnly={readOnly}\n      position={suggestionsPlacement === 'above' ? 'top-start' : 'bottom-start'}\n      middlewares={{ flip: suggestionsPlacement === 'auto', shift: true }}\n      width={anchorMode === 'caret' ? 'max-content' : 'target'}\n      attributes={attributes}\n      onOptionSubmit={handleOptionSubmit}\n      {...comboboxProps}\n    >\n      {anchorMode === 'caret' ? field : <Combobox.DropdownTarget>{field}</Combobox.DropdownTarget>}\n\n      {name ? (\n        <input type=\"hidden\" name={name} form={form} value={walk.value} disabled={disabled} />\n      ) : null}\n\n      <MentionsDropdown\n        query={suggestionsDisplay === 'overlay' && query ? query.query : null}\n        label={a11ySuggestionsListLabel}\n        maxHeight={maxDropdownHeight}\n        unstyled={unstyled}\n        queryState={queryState}\n        source={activeSource}\n        optionIdPrefix={optionIdPrefix}\n        selectedOptionId={selectedOptionId}\n        nothingFoundMessage={nothingFoundMessage}\n        loadingMessage={loadingMessage}\n        errorMessage={errorMessage}\n        getStyles={getStyles}\n      />\n    </Combobox>\n  );\n});\n\nMentions.classes = { ...InputBase.classes, ...Combobox.classes, ...classes };\nMentions.varsResolver = varsResolver;\nMentions.displayName = '@mantine/core/Mentions';\nMentions.Mention = Mention;\n\nexport namespace Mentions {\n  export type Props = MentionsProps;\n  export type StylesNames = MentionsStylesNames;\n  export type CssVariables = MentionsCssVariables;\n  export type Factory = MentionsFactory;\n\n  export namespace Mention {\n    export type Props = MentionProps;\n  }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiJA,MAAM,eAAe;CACnB,YAAY;CACZ,YAAY;CACZ,sBAAsB;CACtB,oBAAoB;CACpB,YAAY;CACZ,MAAM;CACN,MAAM;CACN,gBAAgB;CAChB,cAAc;CACd,0BAA0B;AAC5B;AAEA,MAAM,eAAe,0BAA2C,EAC9D,WAAW;CACT,8BAA8B,KAAA;CAC9B,2BAA2B,KAAA;AAC7B,EACF,EAAE;AAEF,SAAS,iBAAiB,OAA4B;CACpD,OAAO,MAAM,YAAY,eAAe,MAAM,YAAY;AAC5D;AAEA,MAAa,WAAW,SAA0B,WAAW;C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