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 077cdb84a7..3ef71d6180 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 @@ -2178,11 +2179,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) @@ -2500,6 +2504,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 7576816cea..85aeca186c 100644 --- a/docs/integration-contract/package-api.md +++ b/docs/integration-contract/package-api.md @@ -4971,6 +4971,23 @@ the composer renders exactly as before. 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(