
import { AutoTooltipValue } from "../use-auto-tooltip.js";
import { BaseProps, BlockStyleProps, ColorStyleProps, OuterStyleProps, Styles } from "@tenphi/tasty";
import * as react from "react";
import { ReactNode } from "react";
import { OverlayProps } from "react-aria";

//#region src/components/content/InlineInput/InlineInput.d.ts
type CubeInlineInputEditTrigger = 'dblclick' | 'click' | 'none';
interface CubeInlineInputProps extends BaseProps, BlockStyleProps, OuterStyleProps, ColorStyleProps {
  /** Controlled value. When provided, the component is controlled. */
  value?: string;
  /** Initial value for uncontrolled usage. */
  defaultValue?: string;
  /**
   * Fires on commit *only when the value actually changed*. Use this to update
   * external state. Pair with `value` for the controlled pattern.
   */
  onChange?: (value: string) => void;
  /** Controlled editing state. When provided, the editing state is controlled. */
  isEditing?: boolean;
  /** Default editing state for uncontrolled usage. */
  defaultIsEditing?: boolean;
  /** Called when editing mode starts or ends. */
  onEditingChange?: (isEditing: boolean) => void;
  /**
   * Fires every time the user commits (Enter / submit-on-blur / `ref.stopEditing(true)`),
   * even if the value did not change. Use for side effects like analytics or
   * "save" toasts. For state updates, prefer `onChange`.
   *
   * May return a Promise. If the returned Promise **rejects**, the component
   * automatically reverts its optimistic display to the actual `value` prop —
   * this gives async-save flows free rollback on failure (in controlled mode).
   */
  onSubmit?: (value: string) => void | Promise<unknown>;
  /** Called when editing is cancelled (Escape or empty submit when `allowEmpty` is false). */
  onCancel?: () => void;
  /** How edit mode is activated from the display element. Default: `'dblclick'`. */
  editTrigger?: CubeInlineInputEditTrigger;
  /**
   * When true (default) the display element is keyboard-focusable and
   * responds to `Enter`, `F2` and `Space` by entering edit mode. Set to
   * `false` when a host (e.g. an editable tab inside a button) already
   * routes keyboard activation through `ref.startEditing()` — exposing the
   * display element as a separate tab stop would create a nested keyboard
   * focus inside the host.
   *
   * @default true
   */
  keyboardActivation?: boolean;
  /** Whether to submit when focus leaves the input. Default: `true`. */
  submitOnBlur?: boolean;
  /** Whether to trim the value on submit. Default: `true`. */
  trimOnSubmit?: boolean;
  /** When false, submitting an empty/whitespace value cancels instead. Default: `false`. */
  allowEmpty?: boolean;
  /** When true, edit mode cannot be entered (programmatically or otherwise). */
  isDisabled?: boolean;
  /** When true, edit mode cannot be entered, but the display reads as enabled. */
  isReadOnly?: boolean;
  /**
   * When true, applies a styled wrapper to the component (border, fill, padding,
   * fixed height) so it visually matches a `TextInput`. Useful when swapping a
   * field component (e.g. `Select`) for an `InlineInput` to rename / edit the
   * current value without a visual jump.
   *
   * @default false
   */
  isStyled?: boolean;
  /** Placeholder text shown in the input when the draft is empty. */
  placeholder?: string;
  /** Custom render for display (non-editing) mode. Receives the currently-displayed value (including optimistic). */
  renderDisplay?: (value: string) => ReactNode;
  /** ARIA label for the input (used when no visible label is associated). */
  'aria-label'?: string;
  /** ARIA labelledby for the input. */
  'aria-labelledby'?: string;
  /**
   * Tooltip behaviour for the display value:
   * - `true` (default): auto-tooltip — show the full value when the text is truncated.
   * - `false`: never show a tooltip.
   * - `string`: always show this tooltip text.
   * - object: full `TooltipProvider` configuration (with optional `auto`).
   *
   * The tooltip is automatically suppressed while editing and when `renderDisplay` is used.
   */
  tooltip?: AutoTooltipValue;
  /** Default tooltip placement. @default 'top' */
  tooltipPlacement?: OverlayProps['placement'];
  /** Convenience prop for styling the `Input` sub-element. Merged into `styles.Input`. */
  inputStyles?: Styles;
}
interface CubeInlineInputRef {
  /** Programmatically enter edit mode. */
  startEditing(): void;
  /** Programmatically exit edit mode. `submit=true` commits, `submit=false` cancels. Defaults to commit. */
  stopEditing(submit?: boolean): void;
  /** Focus the underlying element (input when editing, root span otherwise). */
  focus(): void;
  /** Current committed value (includes optimistic value if a parent hasn't synced yet). */
  getValue(): string;
}
/**
 * Inline editable text. Renders the value as inline content by default and
 * swaps to an auto-sizing text input when entering edit mode.
 *
 * Designed to drop into any text context (tab title, heading, paragraph,
 * table cell) without style customization: typography, color, and font family
 * are all inherited from the parent.
 *
 * Value and `isEditing` can each be controlled or uncontrolled independently.
 * Programmatic entry via the imperative ref (`startEditing`/`stopEditing`)
 * works regardless of `editTrigger`.
 */
declare const InlineInput: react.ForwardRefExoticComponent<CubeInlineInputProps & react.RefAttributes<CubeInlineInputRef>>;
//#endregion
export { CubeInlineInputEditTrigger, CubeInlineInputProps, CubeInlineInputRef, InlineInput };
//# sourceMappingURL=InlineInput.d.ts.map