mirror of
https://github.com/bitbaum/chatkit.git
synced 2026-12-04 05:07:23 +01:00
- `@bitbaum/chatkit/attach`: AttachMenu, ATTACH_SOURCE_INPUT, isTextFile, acceptFamilies and shrinkImage without the composer, so an app with no chat (avatars, product photos, receipts) uses the same picker instead of re-rolling a file input. AttachMenu takes `sources` (an image uploader offers Camera + Photos; one source skips the sheet) and a `trigger`. - `chatkit-check-file-inputs` (bin): fails CI on a literal accept that mixes file families — the shape that hid screenshots on Android in loki, orangecat and evig. Same rule as the package (acceptFamilies), so there is one definition; a justified exception is marked on the line. - shrinkImage moves out of the composer hook into src/image.ts (unchanged). - README: install releases from npm, never a commit — heidi and substrata stayed on the broken paperclip because they pinned old versions. Claude-Session: https://claude.ai/code/session_01BWXjqiHm8jFta4FXuc7Tck Co-authored-by: Claude <noreply@anthropic.com>
37 lines
1.7 KiB
TypeScript
37 lines
1.7 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.
|
|
*/
|
|
export declare function AttachMenu({ onFiles, disabled, labels, sources, trigger, }: {
|
|
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;
|
|
}): import("react").JSX.Element;
|
|
//# sourceMappingURL=AttachMenu.d.ts.map
|