import { EditorView } from '@codemirror/view'; import { type DataTestId, type MaskingProps, type StylingProps, type AriaLabelingProps } from '@dynatrace/strato-components/core'; import type { EditorLanguageConfiguration } from './configuration/configuration.js'; import type { GutterConfiguration } from './configuration/getDefaultConfigurations.js'; import type { FormControlStateProps } from '../../core/types/form-control-state.js'; /** * Props used for BaseCodeEditor * @internal **/ export interface BaseCodeEditorProps extends FormControlStateProps, AriaLabelingProps, StylingProps, DataTestId, MaskingProps { /** The id for the DOM element */ id?: string; /** The content of the editor * @defaultValue '' */ value?: string; /** Callback that is called when the value in the editor changes. */ onChange?: (value: string) => void; /** Displayed initially in the editor when there is no other content. */ placeholder?: string; /** Whether spellcheck should be enabled. */ spellCheck?: boolean; /** * If set to true, the code editor uses the full height available in its parent. * @defaultValue false */ fullHeight?: boolean; /** The start indices (character position) that should be folded initially in uncontrolled scenarios. */ defaultFolding?: number[]; /** The start indices (character position) that should be folded initially in controlled scenarios.*/ folding?: number[]; /** Callback that is called when folding changes. */ onFoldingChange?: (values: number[]) => void; /** Whether the input is readonly * @defaultValue false */ readOnly?: boolean; /** Whether long lines should be wrapped * @defaultValue false */ lineWrap?: boolean; /** The language config */ configuration?: EditorLanguageConfiguration; /** * If set to true, the code editor allows only one line and the line number will not be displayed. * @defaultValue false */ singleLine?: boolean; /** * If set to true, the code editor will hide the line numbers * @defaultValue false */ hideLineNumbers?: boolean; /** Callback that is called when the editor loses focus. */ onBlur?: (e: FocusEvent) => void; /** Callback that is called when the editor receives focus. */ onFocus?: (e: FocusEvent) => void; /** * Provides the gutter configuration to display a gutter next to the fold gutter */ gutterConfiguration?: GutterConfiguration; /** * Editor layout size, 'default' for standard spacing and 'condensed' for reduced font size, padding and margins. * @defaultValue 'default' */ size?: 'default' | 'condensed'; /** * If set to true, `aria-required` will be set to true on the input element. * @defaultValue false */ required?: boolean; } /** * public ref type * @internal */ export type BaseCodeEditorRef = { focus: () => void; selectRange: (range: { from: number; to: number; }) => void; readonly element: HTMLDivElement | null; setCursorPosition: (position: number | 'end') => void; editorView?: () => EditorView; }; /** * Provides a base/core component for other code editors to share a common base. * * @internal */ export declare const BaseCodeEditor: (props: BaseCodeEditorProps & import("react").RefAttributes) => React.ReactElement | null;