import React from 'react'; export type InlineEditSize = 'sm' | 'md'; export interface InlineEditProps extends Omit, 'children' | 'defaultValue' | 'onChange'> { /** * What the value is — "Purpose", "Agent name". Required: it names the * field while editing, and the edit button is "Edit" plus it. */ label: string; /** The saved value, when the caller keeps it. */ value?: string; /** The starting value, when the component keeps it. */ defaultValue?: string; /** * Called with the new value on Save. Return a promise to show "Saving…" * while it runs; if it rejects, the editor stays open with the error's * message, and what was typed is kept. */ onSave?: (value: string) => void | Promise; /** Called when editing is cancelled — Cancel, or Escape. */ onCancel?: () => void; /** * Checked on Save, before `onSave`. Return the message to show, or nothing * when the value is fine. */ validate?: (value: string) => string | undefined | null; /** Shown, in secondary text, when there is no value — "Add a purpose". */ placeholder?: string; /** A Textarea instead of an Input. Enter adds a line; ⌘/Ctrl+Enter saves. */ isMultiline?: boolean; /** * The field's size: `sm` in a dense row, `md` beside body text. The value * itself inherits the text around it. */ size?: InlineEditSize; /** Shows the value with no way to edit it. */ isReadOnly?: boolean; /** The edit button's name. Defaults to "Edit" and the label. */ editLabel?: string; saveLabel?: string; savingLabel?: string; cancelLabel?: string; /** Announced after a save. Defaults to the label and "saved". */ savedMessage?: string; /** Shown when `onSave` rejects without a message of its own. */ errorFallback?: string; } /** * InlineEdit — a value that becomes a field where it stands: an agent's * purpose under its name, a row's label. Edit, change, Save or Cancel. * * THE VALUE IS TEXT, AND EDIT IS A BUTTON. In view mode the value is plain * text, read as text; beside it is one tab stop, "Edit purpose". Clicking the * text also opens the editor, for a pointer. A value that is itself a button * would be read as "Edit purpose, button" with the purpose lost. * * FOCUS GOES IN, THEN BACK. Opening the editor focuses the field with its * text selected; Save and Cancel return focus to the Edit button, not to the * top of the page. Escape cancels from anywhere in the editor, and goes no * further — a dialog it sits in does not close as well. * * NOTHING TYPED IS LOST. An invalid value, or a save that fails, keeps the * editor open with the message as the field's error and what was typed still * in it. While a save runs the field is read-only and Save says "Saving…"; * neither is disabled, so focus stays where it was. * * SAVED IS SAID. A status region, always mounted, announces "Purpose saved" — * the editor closing is not, on its own, news to a screen reader. */ export declare const InlineEdit: React.ForwardRefExoticComponent>; //# sourceMappingURL=InlineEdit.d.ts.map