import { type GrafanaTheme2 } from '@grafana/data'; import { type CodeMirrorBasicSetup, type CodeMirrorEditorTheme, type CodeMirrorExtension } from '../CodeMirror/types'; export interface QueryFieldConfigOptions { /** * Called when the user presses Shift+Enter or Ctrl+Enter. Plain Enter keeps * its default behavior and inserts a newline. If the consumer debounces * `onChange`, flush the pending change in this callback before running so the * query that executes matches what was typed. */ onRunQuery?: () => void; /** * Called when the editor loses focus. */ onBlur?: () => void; /** * Placeholder shown while the field is empty. */ placeholder?: string; } export interface QueryFieldConfig { theme: CodeMirrorEditorTheme; basicSetup: CodeMirrorBasicSetup; extensions: CodeMirrorExtension[]; } /** * Configuration for rendering a `CodeMirrorEditor` as a query field: styled as * a standard Grafana input, runs the query on Shift+Enter or Ctrl+Enter, and * wraps long queries instead of scrolling horizontally. Replaces the deprecated * Slate-based `QueryField`. * * Spread the result onto the editor and memoize it — a new config each render * reconfigures the editor: * * ```tsx * const config = useMemo(() => getQueryFieldConfig(theme, { onRunQuery }), [theme, onRunQuery]); * return ; * ``` */ export declare function getQueryFieldConfig(theme: GrafanaTheme2, options?: QueryFieldConfigOptions): QueryFieldConfig;