Files
chatkit/dist/react/AttachMenu.d.ts
T
CatoandClaude 04dd6f86b8 feat: under every answer — Copy, Listen, Share; sources as a sheet; replies that lead (0.10.0) (#20)
The pieces of the ChatGPT app the owner put beside ours (2026-10-21), done
once here so Loki, OrangeCat and every chat in the fleet get them:

- `AnswerActions`: the row under an answer. Copy; Listen, reading the answer
  as prose (`plainTextForSpeech`, from loki) with the browser's voice or the
  `speaker` an app passes (loki's studio voice), with a small player — Stop
  and the time so far — while it reads; Share through the system sheet
  where one exists. `ChatThread` renders it under every answer.
- Sources on a touch screen are ONE "Sources · n" button that opens a sheet
  with every record (label, detail, link); chips stay on a mouse. `Sheet`
  (the attach sheet's <dialog>, extracted) and `SourcesRow` are exported.
- `AttachMenu` takes `extra` rows under Camera · Photos · Files, and then
  opens the sheet on a mouse too — an app's "one of my things" has no file
  dialog to live in.
- The replies instruction makes the model lead: 2–4 replies on every answer,
  the recommended next step first, drawn as the lead (`ck-reply-lead`).
- An empty box is one row on the narrowest phone: the placeholder is cut at
  the edge, never wrapped into a clipped second line.

Browser checks cover the player, the sources sheet on a touch screen and
chips on a mouse, and the one-row placeholder at 320px.


Claude-Session: https://claude.ai/code/session_018WZnBnaLP6RhwFkLxRTKgE

Co-authored-by: Claude <noreply@anthropic.com>
2026-10-21 06:21:21 +02:00

46 lines
2.3 KiB
TypeScript

import { type ReactNode } from "react";
import { type AttachSource } from "../attachments.js";
export type AttachMenuLabels = {
/** The paperclip's name. */
attach: string;
/** The sheet's title. */
title: string;
close: string;
sources: Record<AttachSource, string>;
};
export declare const DEFAULT_ATTACH_MENU_LABELS: AttachMenuLabels;
/**
* The paperclip, and what it opens on a phone: a sheet with Camera, Photos and
* Files — one input each. See `ATTACH_SOURCE_INPUT` for why three inputs and
* not one: a single mixed-`accept` input is what made a phone offer a recorder
* and no way to the screenshot.
*
* The sheet is a native `<dialog>` opened with `showModal()`: it renders in the
* browser's top layer, so a composer inside a transformed or overflow-clipped
* panel (a drawer, a floating rail) still gets a full-screen sheet — and the
* browser supplies Escape, the focus trap and focus restore.
*
* Every app that attaches anything gets this from the composer. An app with a
* custom box renders `<AttachMenu>` itself rather than a bare file input, and
* an app with more to bring into a message than files — one of the person's
* own things, a note the model reads every time — puts those rows in `extra`:
* they sit under Camera · Photos · Files in the same sheet, on every pointer,
* since a mouse cannot reach them through a file dialog.
*/
export declare function AttachMenu({ onFiles, disabled, labels, sources, trigger, extra, onOpenChange, }: {
onFiles: (files: FileList | null) => void;
disabled?: boolean;
labels?: AttachMenuLabels;
/** Which sources to offer, in order. An avatar or product-photo uploader
* passes `["camera", "photos"]`; one source skips the sheet entirely. */
sources?: readonly AttachSource[];
/** The button's content. Defaults to a paperclip icon; an uploader passes
* its own ("Add photo"). The button keeps chatkit's 44px target. */
trigger?: ReactNode;
/** The app's own rows under the three sources (see above). With it the
* sheet opens on every pointer. A row that should close the sheet calls
* the `close` it is given. */
extra?: (close: () => void) => ReactNode;
onOpenChange?: (open: boolean) => void;
}): import("react").JSX.Element;
//# sourceMappingURL=AttachMenu.d.ts.map