import { type Ref } from 'react'; /** * A line of plain text on a page that you edit where it stands, as in a * document: a title, a summary. Ship's title editor (Katerina, 29 September, * findings E1 and E2), moved here for the summary (Miky, 16 October: "it feels * like a document, not a form") so every app's header edits the same way. * * - **No box**, on hover or on click, and nothing moves: the text is the * editor, in its own size and colour. The text cursor is the only sign. * - **The caret goes where you click**, and nothing is selected. * - **Enter saves and moves on** — `onEnter` says where: the title to the * summary, the summary to the description. * - **Escape stops editing and keeps the text**, saving it, as leaving does. * Nothing is thrown away; Ctrl+Z undoes. * - **An unchanged value is not a write.** Leaving it empty brings the saved * one back, unless `clearable`: then empty is saved, as nothing. * - **A refused save keeps your text where it is**, and the app says why * beside it; a change made elsewhere does not overwrite it until you have * saved, changed or emptied it. * * One paragraph and no marks, so pasted line breaks become spaces and it wraps * like text, which a one-line `` cannot. A Tiptap editor rather than a * raw `contenteditable`, so it is the same kind of surface as the description * under it. */ export interface InlineTextProps { /** The saved text. A new value is loaded when you are not in the field and hold nothing unsaved. */ value: string; /** What it is for, muted, while it is empty: "Untitled", "Add a summary". */ placeholder: string; /** The accessible name: "Title", "Summary". */ label: string; /** Save it: resolve `true` when saved; `false` keeps your text in place. */ onCommit: (value: string) => Promise | boolean; /** The text as it is being written, on focus and every change; `null` when you leave. For a count. */ onText?: (text: string | null) => void; /** Enter, after the save has started: where the caret goes next. */ onEnter?: () => void; /** `title`: the page's heading. `summary`: the line under it, quieter. */ variant?: 'title' | 'summary'; /** Empty is a value (a summary). Otherwise leaving it empty brings the saved one back (a title). */ clearable?: boolean; /** Text only, the same size and place: nobody can change it, or the editor is not ready. */ readOnly?: boolean; /** Placement only. */ className?: string; ref?: Ref; } type CaretAt = 'start' | 'end'; export interface InlineTextHandle { /** Put the caret in it, at the start or the end. */ focus: (at?: CaretAt) => void; } export declare function InlineText({ value, placeholder, label, onCommit, onText, onEnter, variant, clearable, readOnly, className, ref }: InlineTextProps): import("react").JSX.Element; export {}; //# sourceMappingURL=InlineText.d.ts.map