
import { _CollectionItem } from "../../CollectionItem.js";
import { CubeTextInputBaseProps } from "../TextInput/TextInputBase.js";
import { ListStateLike, TextFilterFn } from "../ListBoxPopover/listNavigation.js";
import "../ListBoxPopover/index.js";
import { ForwardedRef, ReactElement, ReactNode, RefObject } from "react";
import { Section } from "react-stately";
import { Key as Key$1 } from "@react-types/shared";

//#region src/components/fields/CommandTextArea/CommandTextArea.d.ts
/** A single trigger character with optional placement constraint. */
interface CommandTrigger {
  /** The character that opens the autocomplete (e.g. `/` or `@`). */
  char: string;
  /**
   * When true, the trigger token must start at the beginning of the line the
   * caret is on (right after a newline, or at the very start of the input) —
   * i.e. line-scoped slash commands. When false, the token may appear after
   * any whitespace, anywhere in the text (Slack/Notion-style).
   */
  atLineStart?: boolean;
}
/** Result of scanning the textarea for an active trigger token. */
interface ActiveToken {
  /** The matched trigger descriptor. */
  trigger: CommandTrigger;
  /** The active token text, INCLUDING the trigger char (e.g. `/cle`). */
  token: string;
  /** Inclusive start index of the token in the textarea value. */
  start: number;
  /** Exclusive end index of the token (caret position while typing). */
  end: number;
}
type CommandTextAreaFilterFn = TextFilterFn;
interface CubeCommandTextAreaProps<T> extends Omit<CubeTextInputBaseProps, 'children' | 'multiLine'> {
  /** Whether the textarea should resize to fit its content. */
  autoSize?: boolean;
  /** Max visible rows when `autoSize` is true. Defaults to 10. */
  maxRows?: number;
  /** Number of visible rows. Defaults to 3. */
  rows?: number;
  /** Command/option source (alternative to JSX children). */
  items?: Iterable<T>;
  /** Static items or a render function (same shape as ComboBox/ListBox). */
  children?: ReactNode | ((item: T) => ReactElement);
  /**
   * Triggers that open the autocomplete. Defaults to a single slash command
   * that must start at the beginning of the input.
   */
  triggers?: CommandTrigger[];
  /**
   * Custom filter. Pass `false` to disable internal filtering (server-side).
   */
  filter?: CommandTextAreaFilterFn | false;
  /**
   * Fired when the user picks a command (Enter/Tab/click). The option's
   * `textValue` is also inserted into the textarea regardless.
   */
  onCommand?: (key: Key$1, item: {
    textValue: string;
    [k: string]: any;
  }) => void;
  /** Insert a trailing space after the chosen command. Defaults to true. */
  insertSpaceAfter?: boolean;
  /** Keys of disabled options. */
  disabledKeys?: Iterable<Key$1>;
  /** Popover placement. Chat inputs usually want `top`. Defaults to `top`. */
  direction?: 'bottom' | 'top';
  /** Whether the popover should flip when overflowing. Defaults to true. */
  shouldFlip?: boolean;
  /** Offset between the textarea and the popover. */
  overlayOffset?: number;
  /** Padding between the popover and the viewport edge. */
  containerPadding?: number;
  /** Ref for the textarea element. */
  inputRef?: RefObject<HTMLTextAreaElement>;
  /** Ref for the wrapper element (popover anchor). */
  wrapperRef?: RefObject<HTMLDivElement>;
  /** Ref for the popover overlay element. */
  popoverRef?: RefObject<HTMLDivElement>;
  /** Ref for the listbox element. */
  listBoxRef?: RefObject<HTMLDivElement>;
  /** Ref through which the internal list state is exposed. */
  listStateRef?: RefObject<ListStateLike | null>;
  overlayStyles?: any;
  listBoxStyles?: any;
  optionStyles?: any;
  sectionStyles?: any;
  headingStyles?: any;
}
declare const _CommandTextArea: (<T>(props: CubeCommandTextAreaProps<T> & {
  ref?: ForwardedRef<HTMLElement>;
}) => ReactElement) & {
  Item: typeof _CollectionItem;
  Section: typeof Section;
};
//#endregion
export { ActiveToken, CommandTextAreaFilterFn, CommandTrigger, CubeCommandTextAreaProps, _CommandTextArea };
//# sourceMappingURL=CommandTextArea.d.ts.map