/**
 * @file RichTextEditor.tsx
 * @input Uses React, useId, Lexical (lexical + @lexical/react), Field,
 *   VisuallyHidden, design tokens
 * @output Exports RichTextEditor component, RichTextEditorProps, RichTextEditorStatus,
 *   RichTextEditorStatusType, RichTextEditorSize
 * @position Experimental (lab) implementation; consumed by RichTextEditor/index.ts and
 *   re-exported from @astryxdesign/lab. Tested by RichTextEditor.test.tsx.
 *
 * SYNC: When modified, update these files to stay in sync:
 * - /packages/lab/src/RichTextEditor/RichTextEditor.doc.mjs (props table, features, implementation notes)
 * - /packages/lab/src/RichTextEditor/RichTextEditor.test.tsx (tests for new/changed behavior)
 * - /packages/lab/src/RichTextEditor/index.ts (exports if types change)
 * - /packages/lab/src/index.ts (barrel re-export)
 * - /apps/storybook/stories/RichTextEditor.stories.tsx (storybook stories)
 *
 * NOTE: This is an EXPERIMENTAL component in @astryxdesign/lab (published only under
 * the `@canary` dist-tag, never as stable `latest`). It is the initial landing for the
 * OSS Lexical editor RFC; the goal is graduation to @astryxdesign/core after the
 * Component Specification Protocol. `lexical` and `@lexical/*` are OPTIONAL peer
 * dependencies — install them to use this component.
 */
import { type ReactNode } from 'react';
import type { BaseProps } from '@astryxdesign/core';
import type { SizeValue } from '@astryxdesign/core/utils';
import { type Transformer } from '@lexical/markdown';
export type { Transformer } from '@lexical/markdown';
import { type EditorState, type Klass, type LexicalEditor, type LexicalNode } from 'lexical';
export type RichTextEditorStatusType = 'warning' | 'error' | 'success';
export type RichTextEditorSize = 'sm' | 'md' | 'lg';
export interface RichTextEditorStatus {
    /** The type of status to display. */
    type: RichTextEditorStatusType;
    /** Optional message to display below the editor. */
    message?: string;
}
/**
 * Imperative handle exposed via `ref`. Lets callers focus, clear, and read the
 * editor without wiring a custom plugin. Available after mount.
 */
export interface RichTextEditorRef {
    /**
     * Move focus into the editor's editable surface. No-op when the editor is
     * read-only or disabled.
     */
    focus: () => void;
    /**
     * Remove all content, resetting the editor to a single empty paragraph.
     * No-op when the editor is read-only or disabled.
     */
    clear: () => void;
    /** Read the current `EditorState`. Serialize with `.toJSON()` to persist. */
    getEditorState: () => EditorState;
    /**
     * Serialize the current content to a Markdown string, using the same
     * `transformers` the editor is configured with (so custom transformers
     * layered in via the `transformers` prop are honored). Equivalent to
     * `$convertToMarkdownString` run in a read context.
     */
    getMarkdown: () => string;
    /**
     * Serialize the current content to an HTML string via
     * `$generateHtmlFromNodes`. Requires a DOM (available in the browser and in
     * jsdom-based tests). Useful for copy/paste, email, or non-Lexical consumers.
     */
    getHTML: () => string;
    /**
     * Access the underlying `LexicalEditor` instance for advanced use cases
     * (custom commands, listeners, node transforms).
     */
    getEditor: () => LexicalEditor;
}
export interface RichTextEditorProps extends Omit<BaseProps, 'onChange' | 'defaultValue'> {
    /** Label text for the editor (always rendered for accessibility). */
    label: string;
    /**
     * Whether to visually hide the label (still accessible to screen readers).
     * @default false
     */
    isLabelHidden?: boolean;
    /** Description text displayed between the label and editor. */
    description?: string;
    /**
     * Whether the field is optional. Mutually exclusive with isRequired.
     * @default false
     */
    isOptional?: boolean;
    /**
     * Whether the field is required. Mutually exclusive with isOptional.
     * @default false
     */
    isRequired?: boolean;
    /**
     * Initial serialized editor state (a JSON string produced by
     * `JSON.stringify(editorState.toJSON())`), used to seed the editor on mount.
     * The editor is uncontrolled: this is read once.
     */
    defaultValue?: string;
    /**
     * Callback fired when the editor content changes. Receives the current
     * `EditorState` and the `LexicalEditor` instance. Serialize with
     * `editorState.toJSON()` for persistence.
     */
    onChange?: (editorState: EditorState, editor: LexicalEditor) => void;
    /** Placeholder text shown when the editor is empty. */
    placeholder?: string;
    /**
     * Whether the editor is read-only (non-editable).
     * @default false
     */
    isReadOnly?: boolean;
    /**
     * Whether the editor is disabled (non-editable, dimmed).
     * @default false
     */
    isDisabled?: boolean;
    /**
     * Status indicator. When set, displays a colored border. If message is
     * provided, displays a message box below the editor.
     */
    status?: RichTextEditorStatus;
    /**
     * Width of the field. Numbers are treated as pixels, strings are used as-is
     * (e.g. `'100%'`).
     */
    width?: SizeValue;
    /** Tooltip text to display in an info icon at the end of the label. */
    labelTooltip?: string;
    /**
     * The size of the editor, affecting internal padding.
     * @default 'md'
     */
    size?: RichTextEditorSize;
    /**
     * Additional Lexical nodes to register beyond the default OSS set
     * (Heading, Quote, List, Link, Code). Use this extension point to plug in
     * custom nodes (e.g. mentions, images) without forking the editor.
     */
    nodes?: ReadonlyArray<Klass<LexicalNode>>;
    /**
     * Additional Lexical plugins to render inside the composer. Use this to
     * compose extra behaviour (toolbars, mentions, autolink, etc.) on top of the
     * base editor. Plugins receive the editor via `useLexicalComposerContext()`.
     */
    plugins?: ReactNode;
    /**
     * Whether to enable Markdown shortcut typing (e.g. `# ` for a heading,
     * `- ` for a list). Uses the `transformers` prop (defaults to the standard
     * `@lexical/markdown` transformers).
     * @default true
     */
    hasMarkdownShortcuts?: boolean;
    /**
     * Markdown transformers — the single source of truth for markdown behaviour.
     * Defaults to the standard `@lexical/markdown` `TRANSFORMERS`.
     *
     * The same array drives all three markdown operations in Lexical (see the
     * lexical-playground reference, where one `PLAYGROUND_TRANSFORMERS` array
     * feeds each):
     *  - shortcut typing        — `registerMarkdownShortcuts` (wired here today)
     *  - markdown -> state       — `$convertFromMarkdownString` (future import API)
     *  - state -> markdown       — `$convertToMarkdownString` (future `getMarkdown`)
     *
     * Pass a custom array to support additional node types (e.g. custom
     * transformers layered in via the `nodes` extension point) consistently
     * across all three. Shortcut typing is only applied when
     * `hasMarkdownShortcuts` is true; the array is still the intended input for
     * the serialization APIs added in later phases.
     */
    transformers?: ReadonlyArray<Transformer>;
    /** Whether to automatically focus the editor on mount. @default false */
    hasAutoFocus?: boolean;
    /**
     * Screen-reader hint describing how to move focus out of the editor, since
     * Tab is bound to indentation (press Escape, then Tab). Rendered visually
     * hidden and referenced from the editor's `aria-describedby`. Override it
     * to localize the text, or pass an empty string to omit the hint entirely
     * (e.g. when the host app provides its own instructions).
     * @default 'Press Escape then Tab to move focus out of the editor.'
     */
    tabEscapeHint?: string;
    /**
     * Maximum number of characters. When set, a character counter
     * (current/max) is displayed below the editor. Like TextArea, this does
     * NOT enforce the limit natively — the counter shows error styling when the
     * plain-text length exceeds the limit. Count is the editor's plain-text
     * content length.
     */
    maxLength?: number;
    /**
     * The Lexical composer namespace, used for editor identity.
     * @default 'astryx-editor'
     */
    namespace?: string;
}
/**
 * A WYSIWYG rich-text editor built on Lexical, styled with Astryx design
 * tokens. Experimental — ships from `@astryxdesign/lab` (canary). `lexical` and
 * `@lexical/*` are optional peer dependencies — install them to use this
 * component.
 *
 * The editor is intentionally minimal and extensible: pass `nodes` and
 * `plugins` to layer richer behaviour (toolbars, mentions, hover cards) on top
 * without forking.
 *
 * The forwarded `RichTextEditorRef` exposes imperative `focus()` and `clear()`
 * methods for callers that manage the editor from outside.
 *
 * @example
 * ```
 * import {RichTextEditor, type RichTextEditorRef} from '@astryxdesign/lab';
 * const ref = useRef<RichTextEditorRef>(null);
 * <RichTextEditor
 *   ref={ref}
 *   label="Notes"
 *   placeholder="Write something..."
 *   onChange={state => save(JSON.stringify(state.toJSON()))}
 * />
 * ```
 */
export declare const RichTextEditor: import("react").ForwardRefExoticComponent<RichTextEditorProps & import("react").RefAttributes<RichTextEditorRef>>;
//# sourceMappingURL=RichTextEditor.d.ts.map