From cdc987304b2050ae2adb2859e15b9a41058dd64a Mon Sep 17 00:00:00 2001 From: Alain Schlesser Date: Sun, 8 Nov 2026 22:05:47 +0000 Subject: [PATCH 1/2] CONTRACT: feat(ui-kit): open a spoken turn's transcript details from long-press, the context menu or a focus-only Details stop SpokenTurn gains an optional `details` prop (#3728). It renders one visually hidden Details stop per spoken turn, which shows as a 24px pill on a 44px hit area at the turn's outer bottom corner on keyboard focus or after a 300ms hover, and opens the existing D54 transcript details dialog from Enter, Space, Shift+F10 and the ContextMenu key, with focus returning to the stop. A right-click opens the details unless text inside the turn is selected (T2), and a touch long-press shows the pressed veil at 150ms and opens them at 500ms; more than 10px of movement or a pointercancel aborts. Under (hover: none) the turn's words are not selectable. There is no at-rest hint (T1), no glyph, and no new colour or token. TranscriptQualifiers gains `trigger?: "glyphs" | "reveal"`; the default renders exactly as before. The package-api component and api-report record the added props and the exported SpokenTurnDetails type. Stories under Voice/Chat marks cover rest, the keyboard-only path, focus, hover, the long-press frame and timing, the open details, a right-click with a selection, and reduced motion. Co-Authored-By: Claude Opus 5.5 --- .changeset/spoken-turn-details.md | 5 + api-report/ui-kit.txt | 17 + docs/integration-contract/package-api.md | 17 + .../src/conversation/TranscriptQualifiers.tsx | 27 +- packages/ui-kit/src/index.ts | 1 + packages/ui-kit/src/tokens.css | 27 ++ packages/ui-kit/src/voice/SpokenTurn.tsx | 88 ++++- .../stories/voice/ChatMarks.stories.tsx | 323 +++++++++++++++++- .../ui-kit/tests/spoken-turn-details.test.tsx | 59 ++++ .../visual/spoken-turn-details.visual.tsx | 69 ++++ 10 files changed, 625 insertions(+), 8 deletions(-) create mode 100644 .changeset/spoken-turn-details.md create mode 100644 packages/ui-kit/tests/spoken-turn-details.test.tsx create mode 100644 packages/ui-kit/tests/visual/spoken-turn-details.visual.tsx diff --git a/.changeset/spoken-turn-details.md b/.changeset/spoken-turn-details.md new file mode 100644 index 0000000000..612f67d058 --- /dev/null +++ b/.changeset/spoken-turn-details.md @@ -0,0 +1,5 @@ +--- +"@schlessera/brain-ui-kit": minor +--- + +`SpokenTurn` gains an optional `details` prop (#3728). A spoken turn with details renders one visually hidden "Details" stop that shows as a pill on keyboard focus or a 300ms hover, and opens the existing transcript details dialog from Enter, Space, Shift+F10, the ContextMenu key, a right-click or a 500ms touch long-press, with focus returning on close. A right-click with text selected inside the turn keeps the native menu, and no evidence glyph renders. `TranscriptQualifiers` gains `trigger?: "glyphs" | "reveal"`; the default `"glyphs"` is unchanged. The new `SpokenTurnDetails` type is exported. diff --git a/api-report/ui-kit.txt b/api-report/ui-kit.txt index c029d6ebe4..ac6b94ff8d 100644 --- a/api-report/ui-kit.txt +++ b/api-report/ui-kit.txt @@ -241,6 +241,7 @@ export "." (./src/index.ts) SpokenMark type SpokenMarkProps SpokenTurn + type SpokenTurnDetails type SpokenTurnProps StartCard type StartCardNotice @@ -2176,11 +2177,14 @@ signatures (every public export and the types it is made of) } SpokenTurn (packages/ui-kit/src/voice/SpokenTurn.tsx) export function SpokenTurn(p: SpokenTurnProps): import("react").JSX.Element; + SpokenTurnDetails (packages/ui-kit/src/voice/SpokenTurn.tsx) + export type SpokenTurnDetails = Omit; SpokenTurnProps (packages/ui-kit/src/voice/SpokenTurn.tsx) export interface SpokenTurnProps { speaker: Speaker; inProgress?: boolean; cutOff?: boolean; + details?: SpokenTurnDetails; children?: ReactNode; } StartCard (packages/ui-kit/src/voice/StartCard.tsx) @@ -2497,6 +2501,19 @@ signatures (every public export and the types it is made of) onExpandedChange?: (expanded: boolean) => void; isStatic?: boolean; } + TranscriptQualifiersProps (packages/ui-kit/src/conversation/TranscriptQualifiers.tsx) + export interface TranscriptQualifiersProps { + kind: "recognized" | "generated" | "task-request" | "task-result"; + source?: string; + playback?: "played" | "unknown" | "not-spoken"; + restored?: boolean; + unsaved?: boolean; + orderUnknown?: boolean; + finish?: "updating" | "some-updating" | "finished" | "unknown"; + evidenceLabel: string; + children: ReactNode; + trigger?: "glyphs" | "reveal"; + } Tray (packages/ui-kit/src/blocks/Tray.tsx) const Tray: import("react").ForwardRefExoticComponent>; TrayProps (packages/ui-kit/src/blocks/Tray.tsx) diff --git a/docs/integration-contract/package-api.md b/docs/integration-contract/package-api.md index 970ded3e13..521d9fb0e0 100644 --- a/docs/integration-contract/package-api.md +++ b/docs/integration-contract/package-api.md @@ -4906,6 +4906,23 @@ composer's, has neither. Existing props and defaults are otherwise unchanged, and no wire schema changes. `api-report/` records the added prop. + + +## Spoken-turn details (additive, 0.45.0, #3728) + +`SpokenTurnProps` in `@schlessera/brain-ui-kit` gains optional +`details?: SpokenTurnDetails`, and the package exports the new type +`SpokenTurnDetails` (`Omit`). With it, a +spoken turn renders one visually hidden "Details" stop, named by the existing +transcript-qualifier string and marked `aria-haspopup="dialog"`, that shows as a +pill on keyboard focus or after a 300ms pointer hover. Enter, Space, Shift+F10, +the ContextMenu key, a right-click (unless text inside the turn is selected) and +a 500ms touch long-press open the existing transcript details dialog, and focus +returns to the stop on close. No glyph renders. `TranscriptQualifiersProps`, +now reachable through that type, gains optional `trigger?: "glyphs" | "reveal"`; +omitted or `"glyphs"`, the trigger renders exactly as before. A turn without +`details` is unchanged. `api-report/` records the added props and type. + ## Prospective trust policy data (additive, #3607) The governance policy types reachable through ui-server's public signatures diff --git a/packages/ui-kit/src/conversation/TranscriptQualifiers.tsx b/packages/ui-kit/src/conversation/TranscriptQualifiers.tsx index edc09fdef4..4ab34b9d44 100644 --- a/packages/ui-kit/src/conversation/TranscriptQualifiers.tsx +++ b/packages/ui-kit/src/conversation/TranscriptQualifiers.tsx @@ -42,6 +42,14 @@ export interface TranscriptQualifiersProps { finish?: "updating" | "some-updating" | "finished" | "unknown"; evidenceLabel: string; children: ReactNode; + /** + * How the details are reached. `glyphs` (the default) is the evidence glyph + * button with its hover and focus tooltip. `reveal` is a visually hidden + * "Details" stop that shows as a pill on focus, or when its host sets + * `data-reveal` on an ancestor (hover); it carries no glyph and no tooltip, + * and opens the same dialog (#3728). + */ + trigger?: "glyphs" | "reveal"; } const finishCopy = { @@ -112,17 +120,28 @@ export function TranscriptQualifiers(p: TranscriptQualifiersProps) { }, [shown]); const returnFocus = () => trigger.current?.isConnected ? trigger.current : anchor.current?.isConnected ? anchor.current : owner?.returnFocus() ?? null; const portal = trigger.current?.ownerDocument.body; - return <> - + : + ; + return <> + {control} {portal && shown && createPortal(