From 016efec6d5cb3ec4626ff25b8cb2c1513136bb44 Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Mon, 2 Nov 2026 17:40:19 +0000 Subject: [PATCH 1/3] CONTRACT: feat(ui-kit): name the composer's attach menu and show the name as a pointer tooltip (#3045) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The kit Composer gains an additive attachLabel prop, defaulting to "Attach — photo, camera, files". An actionable attach trigger paints the same string as an aria-hidden tooltip: shown after 400ms of hover and at once on keyboard focus, dismissed by Escape or opening the menu, hoverable, anchored above the field, and never rendered under (hover: none). Dismissal lives on the trigger's attribute so the composer keeps one render per keystroke. The package-api contract component and the API report record the prop. Refs #3045 Co-Authored-By: Claude Opus 5.5 --- api-report/ui-kit.txt | 1 + docs/integration-contract/package-api.md | 12 +++ packages/ui-kit/src/chrome/Composer.tsx | 87 +++++++++++++++++-- packages/ui-kit/src/tokens.css | 62 +++++++++++++ .../stories/chrome/Composer.stories.tsx | 4 +- .../ui-kit/tests/composer-attach-tip.test.tsx | 45 ++++++++++ 6 files changed, 203 insertions(+), 8 deletions(-) create mode 100644 packages/ui-kit/tests/composer-attach-tip.test.tsx diff --git a/api-report/ui-kit.txt b/api-report/ui-kit.txt index 7b44c69f3e..e352a97382 100644 --- a/api-report/ui-kit.txt +++ b/api-report/ui-kit.txt @@ -833,6 +833,7 @@ signatures (every public export and the types it is made of) onSend?: (value: string) => void; onStop?: () => void; onAttach?: () => void; + attachLabel?: string; onMic?: () => void; mic?: boolean; micLabel?: string; diff --git a/docs/integration-contract/package-api.md b/docs/integration-contract/package-api.md index c1d09ed1d0..f02f9a2caf 100644 --- a/docs/integration-contract/package-api.md +++ b/docs/integration-contract/package-api.md @@ -4237,3 +4237,15 @@ packet audio. Unsupported codec/container forms, including audio/mp4, retain conservative elapsed-wall timestamps for the rest of that recording. Old stored wall timestamps remain readable without migration. No field, stop reason or state is added. This semantic change ships in a minor before 1.0. + + + +## Composer attach label (additive, 0.45.0, #3045) + +`ComposerProps` in `@schlessera/brain-ui-kit` gains optional +`attachLabel?: string`, the attach trigger's accessible name. Omitted or empty, +it is "Attach — photo, camera, files" (previously the fixed +"Attach — photo, camera, file"). An actionable trigger also paints that name as +an `aria-hidden` pointer tooltip; an inert trigger, including a dictating +composer's, has neither. Existing props and defaults are otherwise unchanged, +and no wire schema changes. `api-report/` records the added prop. diff --git a/packages/ui-kit/src/chrome/Composer.tsx b/packages/ui-kit/src/chrome/Composer.tsx index 621f2554dc..2d2b81f0db 100644 --- a/packages/ui-kit/src/chrome/Composer.tsx +++ b/packages/ui-kit/src/chrome/Composer.tsx @@ -126,8 +126,15 @@ export interface ComposerProps { onSend?: (value: string) => void; /** The stop disc while `streaming`, and `esc` inside the field. */ onStop?: () => void; - /** Opens the app's own capture menu (photo, camera, file). */ + /** Opens the app's own capture menu (photo, camera, files). */ onAttach?: () => void; + /** + * The attach trigger's accessible name, and the pointer tooltip that shows + * it: the actions the app's menu currently offers, in menu order. Starts + * with "Attach" so an instruction naming the control still matches it. + * Defaults to "Attach — photo, camera, files". + */ + attachLabel?: string; /** Opens capture, or stops it while `dictating`. */ onMic?: () => void; /** @@ -141,6 +148,9 @@ export interface ComposerProps { maxRows?: number; } +/** The attach trigger's default name: the capture menu with no live conversation in it. */ +const ATTACH_LABEL = "Attach — photo, camera, files"; + export type ComposerState = "ready" | "streaming" | "reconnecting" | "offline" | "dictating"; export interface ComposerRecall { @@ -218,6 +228,8 @@ export function Composer(p: ComposerProps) { } const field: CSSProperties = { + // The attach tooltip anchors to the field, so it clears a grown field. + position: "relative", flex: 1, minWidth: 0, display: "flex", @@ -302,7 +314,7 @@ export function Composer(p: ComposerProps) {
{showAttach ? ( - + ) : null}