@gemboss/ui 0.61.0 → 0.64.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (45) hide show
  1. package/CHANGELOG.md +153 -0
  2. package/README.md +163 -2
  3. package/catalog/editor.html +1 -1
  4. package/catalog/index.html +3 -3
  5. package/gemboss-ui.css +3 -3
  6. package/package.json +15 -1
  7. package/parts/components.css +3 -3
  8. package/parts/core.css +1 -1
  9. package/parts/shell.css +1 -1
  10. package/src/app-nav.css +1 -0
  11. package/src/app-nav.tsx +236 -0
  12. package/src/assistant/chat.tsx +67 -4
  13. package/src/assistant/dictation.ts +292 -0
  14. package/src/assistant/index.ts +4 -1
  15. package/src/audiences-table.css +1 -0
  16. package/src/audiences-table.tsx +167 -0
  17. package/src/chat-voice.css +1 -0
  18. package/src/editor/frame-context.ts +9 -0
  19. package/src/editor/index.ts +8 -0
  20. package/src/editor/inspector-frame.tsx +285 -0
  21. package/src/editor/label-side.ts +79 -0
  22. package/src/editor/panel.tsx +23 -6
  23. package/src/editor/repeater.tsx +9 -3
  24. package/src/editor-inspector-frame.css +1 -0
  25. package/src/editor.css +1 -1
  26. package/src/email-editor/editor.tsx +434 -0
  27. package/src/email-editor/index.ts +16 -0
  28. package/src/email-editor/model.ts +357 -0
  29. package/src/email-editor/preview.tsx +208 -0
  30. package/src/email-editor.css +1 -0
  31. package/src/gem-at-work.css +1 -0
  32. package/src/gem-at-work.ts +1165 -0
  33. package/src/index.ts +17 -1
  34. package/src/kit-plain.css +1 -1
  35. package/src/rail-mini.css +1 -0
  36. package/src/report-charts.css +1 -0
  37. package/src/shell.tsx +36 -8
  38. package/src/skill-feedback.css +1 -0
  39. package/src/skill-feedback.tsx +67 -0
  40. package/src/skill-history.css +1 -0
  41. package/src/skill-history.tsx +116 -0
  42. package/src/skill-pages.css +1 -0
  43. package/src/skill-pages.tsx +204 -0
  44. package/src/skill-tabs-group.tsx +45 -0
  45. package/src/skill-view.tsx +7 -1
@@ -0,0 +1,236 @@
1
+ "use client";
2
+
3
+ /**
4
+ * AppNav — @gemboss/ui 0.62.0. A section's own nav beside a folded rail (Chris 05/11/2026: "vào plugin co sidebar menu lại thành dạng thanh
5
+ * icon … để toàn bộ không gian cho plugin", "mọi plugin nên tổ chức như cách bạn tổ chức cho gempersonalizer … visual ko đánh nhau với thanh
6
+ * icon"; canvas Hsou4RYohWWXpzv1jHbtYZ, direction A, `PluginNav`). Three planes that never read as one long menu: the rail is icons on
7
+ * white, this is words on light grey (`--gemboss-appnav-bg`), the page is white. No icon in a row: the rail already has them.
8
+ *
9
+ * Any section that opens as an app of its own draws it (a plugin, the admin's Reach): nothing in it knows what the section is.
10
+ * - `identity`: the section's tile (its icon on a 32px iris tile), its name, and a status line (a dot in `tone` + the words). With
11
+ * `onSwitch` or `switchMenu` the header is the switcher: a button with a chevron; `switchMenu` is what it opens under it, 280 wide
12
+ * over the page (rows of `AppNavSwitchRow`, an `<hr />` between runs, `switchHeading` over them), held open by AppNav and closed by
13
+ * Escape, a press outside or a row followed.
14
+ * - `groups`: `[{ heading?, items: [{ label, href, current?, count?, badge? }] }]`, the first usually without a heading. `current`
15
+ * is `aria-current="page"`, white and bold; `count` a muted number at the row's end; `badge` an iris pill for what waits on the
16
+ * seller (`badgeLabel` says it to a screen reader).
17
+ * - `foot`: pinned under the rows, above a line: an `AppNavLink` (Settings) and an `AppNavPublish`.
18
+ * Real links (`linkAs` for a router's), real buttons, one `nav` named by `label` (the section's name by default).
19
+ *
20
+ * At 768px and below the same data is the header and one row of chips across the page, the current one filled near-black; a group's
21
+ * heading and a row's count are left out there, the foot's rows join the chips. `AppNavFrame` lays the nav beside the page: it sticks
22
+ * under the topbar, and the page is the kit's 900 column. Its rail folds with `railMode="mini"` on the shell (rail-mini.css comes with
23
+ * this file). Its own entry, `@gemboss/ui/app-nav.css`.
24
+ */
25
+ import "./app-nav.css";
26
+ import "./rail-mini.css";
27
+ import React, { useCallback, useEffect, useId, useRef, useState, type ReactNode } from "react";
28
+ import { Icon } from "./icons";
29
+
30
+ const cx = (...p: Array<string | false | null | undefined>) => p.filter(Boolean).join(" ");
31
+
32
+ /** What a status dot says: on (green), off (grey), or waiting on something (amber). */
33
+ export type AppNavTone = "on" | "off" | "wait";
34
+
35
+ export interface AppNavItem {
36
+ label: string;
37
+ href: string;
38
+ current?: boolean;
39
+ /** A muted number at the row's end (how many there are). */
40
+ count?: number | string;
41
+ /** An iris pill: how many wait on the seller. Wins over `count` when both are given. */
42
+ badge?: number | string;
43
+ /** The badge in words, for a screen reader ("4 need you"). Default: the number. */
44
+ badgeLabel?: string;
45
+ }
46
+
47
+ export interface AppNavGroup {
48
+ heading?: string;
49
+ items: readonly AppNavItem[];
50
+ }
51
+
52
+ export interface AppNavIdentity {
53
+ /** Drawn on the 32px iris tile, 18px. */
54
+ icon?: ReactNode;
55
+ name: string;
56
+ /** The line under the name ("On · 2 places"). */
57
+ status?: ReactNode;
58
+ /** The dot before the status line. None: no dot. */
59
+ tone?: AppNavTone;
60
+ }
61
+
62
+ export interface AppNavProps {
63
+ identity: AppNavIdentity;
64
+ groups: readonly AppNavGroup[];
65
+ foot?: ReactNode;
66
+ /** The nav's accessible name. Default: the section's name. */
67
+ label?: string;
68
+ /** The header is a button: pressed, this runs (and `switchMenu`, when given, opens). */
69
+ onSwitch?: () => void;
70
+ /** What the header opens under it: rows of `AppNavSwitchRow`. */
71
+ switchMenu?: ReactNode;
72
+ /** The header button's name. Default "Switch". */
73
+ switchLabel?: string;
74
+ /** A heading over the menu's rows ("Your plugins"). */
75
+ switchHeading?: string;
76
+ /** The component a row's link renders (a router's Link). Default `a`. */
77
+ linkAs?: React.ElementType;
78
+ /** A row pressed (before the link is followed): a surface that changes the page itself calls `preventDefault`. */
79
+ onItemClick?: (item: AppNavItem, event: React.MouseEvent<HTMLElement>) => void;
80
+ className?: string;
81
+ }
82
+
83
+ function Dot({ tone }: { tone?: AppNavTone }) {
84
+ return tone ? <span className="ui-appnav__dot" data-tone={tone} aria-hidden="true" /> : null;
85
+ }
86
+
87
+ export function AppNav({ identity, groups, foot, label, onSwitch, switchMenu, switchLabel = "Switch", switchHeading, linkAs: Link = "a", onItemClick, className }: AppNavProps) {
88
+ const id = useId();
89
+ const [open, setOpen] = useState(false);
90
+ const button = useRef<HTMLButtonElement>(null);
91
+ const menu = useRef<HTMLDivElement>(null);
92
+ const hasMenu = switchMenu !== undefined && switchMenu !== null;
93
+ const switches = Boolean(onSwitch) || hasMenu;
94
+ const close = useCallback((focus: boolean) => { setOpen(false); if (focus) button.current?.focus(); }, []);
95
+ useEffect(() => {
96
+ if (!open) return undefined;
97
+ const onKey = (e: KeyboardEvent) => { if (e.key === "Escape") { e.preventDefault(); close(true); } };
98
+ const onDown = (e: PointerEvent) => {
99
+ const at = e.target as Node;
100
+ if (!menu.current?.contains(at) && !button.current?.contains(at)) close(false);
101
+ };
102
+ window.addEventListener("keydown", onKey);
103
+ window.addEventListener("pointerdown", onDown);
104
+ return () => { window.removeEventListener("keydown", onKey); window.removeEventListener("pointerdown", onDown); };
105
+ }, [open, close]);
106
+ const head = (
107
+ <>
108
+ <span className="ui-appnav__tile" aria-hidden="true">{identity.icon}</span>
109
+ <span className="ui-appnav__who">
110
+ <span className="ui-appnav__name">{identity.name}</span>
111
+ {identity.status ? <span className="ui-appnav__status"><Dot tone={identity.tone} />{identity.status}</span> : null}
112
+ </span>
113
+ </>
114
+ );
115
+ return (
116
+ <nav className={cx("ui-appnav", className)} aria-label={label ?? identity.name}>
117
+ <div className="ui-appnav__head">
118
+ {switches ? (
119
+ <button ref={button} type="button" className="ui-appnav__switch" aria-label={`${switchLabel}: ${identity.name}`}
120
+ aria-expanded={hasMenu ? open : undefined} aria-controls={hasMenu ? `${id}-menu` : undefined}
121
+ onClick={() => { onSwitch?.(); if (hasMenu) setOpen((o) => !o); }}>
122
+ {head}
123
+ <svg className="ui-appnav__chevron" width="16" height="16" viewBox="0 0 16 16" aria-hidden="true" focusable="false">
124
+ <path d="M5 6.5 8 3.5l3 3M5 9.5l3 3 3-3" fill="none" stroke="currentColor" strokeWidth="1.5" strokeLinecap="round" strokeLinejoin="round" />
125
+ </svg>
126
+ </button>
127
+ ) : <div className="ui-appnav__switch">{head}</div>}
128
+ {hasMenu ? (
129
+ // A row followed closes it; a link's own navigation goes on.
130
+ <div ref={menu} id={`${id}-menu`} className="ui-appnav__menu gemboss-popover-surface" hidden={!open}
131
+ onClick={(e) => { if ((e.target as Element).closest?.("a, button")) close(false); }}>
132
+ {switchHeading ? <p className="ui-appnav__menu-heading">{switchHeading}</p> : null}
133
+ {switchMenu}
134
+ </div>
135
+ ) : null}
136
+ </div>
137
+ <div className="ui-appnav__body">
138
+ <div className="ui-appnav__rows">
139
+ {groups.map((g, gi) => <Group key={g.heading ?? `g${gi}`} group={g} Link={Link} onItemClick={onItemClick} />)}
140
+ </div>
141
+ {foot ? <div className="ui-appnav__foot">{foot}</div> : null}
142
+ </div>
143
+ </nav>
144
+ );
145
+ }
146
+
147
+ function Group({ group, Link, onItemClick }: { group: AppNavGroup; Link: React.ElementType; onItemClick?: AppNavProps["onItemClick"] }) {
148
+ const headingId = useId();
149
+ const rows = group.items.map((it) => (
150
+ <Link key={it.href + it.label} href={it.href} className="ui-appnav__item" aria-current={it.current ? "page" : undefined}
151
+ onClick={onItemClick ? (e: React.MouseEvent<HTMLElement>) => onItemClick(it, e) : undefined}>
152
+ <span className="ui-appnav__label">{it.label}</span>
153
+ {it.badge !== undefined && it.badge !== null && it.badge !== ""
154
+ ? <span className="ui-appnav__badge" role="img" aria-label={it.badgeLabel ?? String(it.badge)}>{it.badge}</span>
155
+ : it.count !== undefined && it.count !== null && it.count !== "" ? <span className="ui-appnav__count">{it.count}</span> : null}
156
+ </Link>
157
+ ));
158
+ if (!group.heading) return <div className="ui-appnav__group">{rows}</div>;
159
+ return (
160
+ <div className="ui-appnav__group" role="group" aria-labelledby={headingId}>
161
+ <div className="ui-appnav__heading" id={headingId}>{group.heading}</div>
162
+ {rows}
163
+ </div>
164
+ );
165
+ }
166
+
167
+ /** A row in the foot (Settings): an item's look, a link or, with `as="button"`, an action. */
168
+ export function AppNavLink({ as: Comp = "a", current, className, children, ...rest }:
169
+ { as?: React.ElementType; current?: boolean; className?: string; children?: ReactNode } & Record<string, unknown>) {
170
+ return (
171
+ <Comp className={cx("ui-appnav__item", "ui-appnav__item--foot", className)} aria-current={current ? "page" : undefined} {...rest}>
172
+ <span className="ui-appnav__label">{children}</span>
173
+ </Comp>
174
+ );
175
+ }
176
+
177
+ /**
178
+ * The foot's Publish. Something waiting (`changes` > 0, or `pending` when it cannot be counted): "N changes not live" and the button,
179
+ * held while `busy`. Nothing waiting: `live` ("Live on your store") with a tick, or nothing when `live` is null (unknown yet).
180
+ */
181
+ export function AppNavPublish({ changes = 0, pending = false, busy = false, onPublish, live = "Live on your store", publishLabel = "Publish", className }: {
182
+ changes?: number;
183
+ pending?: boolean;
184
+ busy?: boolean;
185
+ onPublish: () => void;
186
+ live?: ReactNode | null;
187
+ publishLabel?: string;
188
+ className?: string;
189
+ }) {
190
+ if (changes > 0 || pending) {
191
+ const words = changes > 0 ? `${changes} ${changes === 1 ? "change" : "changes"} not live` : "Changes not live";
192
+ return (
193
+ <div className={cx("ui-appnav__publish", className)}>
194
+ <span className="ui-appnav__changes">{words}</span>
195
+ <button type="button" className="ui-appnav__publish-btn" onClick={onPublish} disabled={busy} aria-busy={busy || undefined}>
196
+ {busy ? "Publishing…" : publishLabel}
197
+ </button>
198
+ </div>
199
+ );
200
+ }
201
+ if (live === null || live === undefined || live === false) return null;
202
+ return (
203
+ <p className={cx("ui-appnav__live", className)} role="status">
204
+ <Icon name="check" size={14} className="ui-appnav__tick" />
205
+ {live}
206
+ </p>
207
+ );
208
+ }
209
+
210
+ /** One row of the switcher's menu (canvas `switcher`): another section, its dot, its name and a short note at the end ("Off", "4 need
211
+ * you"). `current` marks the open one. The dot says On / Off / Waiting to a screen reader when no note says it. */
212
+ export function AppNavSwitchRow({ as: Comp = "a", icon, name, tone, note, current, className, ...rest }:
213
+ { as?: React.ElementType; icon?: ReactNode; name: ReactNode; tone?: AppNavTone; note?: ReactNode; current?: boolean; className?: string } & Record<string, unknown>) {
214
+ const said = tone === "on" ? "On" : tone === "off" ? "Off" : "Waiting";
215
+ return (
216
+ <Comp className={cx("ui-appnav__switchrow", className)} aria-current={current ? "page" : undefined} {...rest}>
217
+ {tone ? <span className="ui-appnav__dot" data-tone={tone} {...(note ? { "aria-hidden": true } : { role: "img", "aria-label": said })} /> : null}
218
+ {icon !== undefined ? <span className="ui-appnav__switchicon" aria-hidden="true">{icon}</span> : null}
219
+ <span className="ui-appnav__label">{name}</span>
220
+ {note ? <span className="ui-appnav__note">{note}</span> : null}
221
+ </Comp>
222
+ );
223
+ }
224
+
225
+ /** The nav beside the page: the nav sticks under the topbar, the page is the kit's 900 column right of it. Inside `ShellMain`, which
226
+ * gives up its gutter for it. */
227
+ export function AppNavFrame({ nav, children, className }: { nav: ReactNode; children?: ReactNode; className?: string }) {
228
+ return (
229
+ <div className={cx("ui-appframe", className)}>
230
+ {nav}
231
+ <div className="ui-appframe__main">
232
+ <div className="ui-appframe__page">{children}</div>
233
+ </div>
234
+ </div>
235
+ );
236
+ }
@@ -23,6 +23,7 @@
23
23
  */
24
24
  import "../chat.css";
25
25
  import "../chat-composer.css";
26
+ import "../chat-voice.css"; // the composer's microphone (`voice`), its own entry: the bundle chat-composer.css sits in is frozen
26
27
  import "../assistant-chat.css";
27
28
  import "../assistant-engine.css"; // BridgeNotice and the engine chip's density rules (engine.tsx brings it too)
28
29
  import React, {
@@ -30,6 +31,7 @@ import React, {
30
31
  type ClipboardEventHandler, type KeyboardEventHandler, type ReactNode, type Ref, type RefObject,
31
32
  } from "react";
32
33
  import { BridgeNotice, copyText } from "./engine";
34
+ import { DICTATION_NOTE, useDictation } from "./dictation";
33
35
  import { EngineMark } from "./engine-mark";
34
36
  import { isEngineMarkId } from "./engine-mark-art";
35
37
  import { CODE_FOLD_LINES, linkTarget, parseBlocks, parseInline, type Block, type ImageHost } from "./chat-markdown";
@@ -40,11 +42,14 @@ const useBeforePaint = typeof window === "undefined" ? useEffect : useLayoutEffe
40
42
  /** Every word the chat says. English, like every surface's chrome (Chris 03/10/2026). */
41
43
  export interface ChatLabels {
42
44
  thread: string; message: string; send: string; stop: string; attach: string;
45
+ /** The microphone (ChatComposer `voice`): its name, its tooltip while it listens, the word on the line above the box. */
46
+ speak: string; stopListening: string; listening: string;
43
47
  copy: string; copied: string; copyCommand: string; originalError: string; stopped: string;
44
48
  steps: string; thought: string; thinking: string; working: string; showLess: string; showAll: string; openImage: string;
45
49
  }
46
50
  export const CHAT_EN: ChatLabels = {
47
51
  thread: "Conversation", message: "Message", send: "Send", stop: "Stop", attach: "Attach a file",
52
+ speak: "Speak instead of typing", stopListening: "Stop listening", listening: "Listening",
48
53
  copy: "Copy", copied: "Copied", copyCommand: "Copy command", originalError: "Original error", stopped: "Stopped",
49
54
  steps: "What it is doing", thought: "Thought", thinking: "Thinking", working: "Working", showLess: "Show less", showAll: "Show all {n} lines",
50
55
  openImage: "Open image",
@@ -568,10 +573,27 @@ export function PaperclipIcon() {
568
573
  </svg>
569
574
  );
570
575
  }
576
+ function MicIcon() {
577
+ return (
578
+ <svg viewBox="0 0 24 24" aria-hidden="true" focusable="false" fill="none" stroke="currentColor" strokeWidth="1.8" strokeLinecap="round" strokeLinejoin="round">
579
+ <rect x="9" y="3" width="6" height="11" rx="3" />
580
+ <path d="M5 11a7 7 0 0 0 14 0M12 18v3" />
581
+ </svg>
582
+ );
583
+ }
571
584
  function SendIcon() {
572
585
  return <svg viewBox="0 0 20 20" aria-hidden="true" focusable="false"><path d="M10.53 4.47a.75.75 0 0 0-1.06 0l-4.5 4.5a.75.75 0 0 0 1.06 1.06l3.22-3.22v8.69a.75.75 0 0 0 1.5 0v-8.69l3.22 3.22a.75.75 0 1 0 1.06-1.06l-4.5-4.5Z" /></svg>;
573
586
  }
574
587
 
588
+ export interface ChatComposerVoice {
589
+ /** A language known for sure ("vi"), and one only guessed, used where the browser lists it (see `dictationLanguage`). */
590
+ lang?: string | null;
591
+ likelyLang?: string | null;
592
+ /** A pause this long after the last words stops listening (default 6 s); before any words, `firstWordsMs` (10 s). */
593
+ silenceMs?: number;
594
+ firstWordsMs?: number;
595
+ }
596
+
575
597
  export interface ChatComposerProps {
576
598
  value: string;
577
599
  onChange: (value: string) => void;
@@ -596,6 +618,13 @@ export interface ChatComposerProps {
596
618
  tools?: ReactNode;
597
619
  /** Full-width rows above the text box (a pending attachment). */
598
620
  top?: ReactNode;
621
+ /**
622
+ * SPEAK INSTEAD OF TYPING (B15-voice, 08/11/2026): the browser's own speech to text, into this box (./dictation.ts). A mic
623
+ * after the tools, what is said written into the box as it is said and editable, a line over the box while it listens (and the
624
+ * one note on where the voice goes) or when it failed. Never sends: Send does. No button where the browser cannot listen.
625
+ * `lang`: the language the app already knows (the conversation's), else the browser's.
626
+ */
627
+ voice?: boolean | ChatComposerVoice;
599
628
  /** Beside the action ("2 queued"). */
600
629
  status?: ReactNode;
601
630
  maxLength?: number;
@@ -620,6 +649,14 @@ export function ChatComposer(p: ChatComposerProps) {
620
649
  const [density, setDensity] = useState<ComposerDensity>("full");
621
650
  const [remeasure, setRemeasure] = useState(0);
622
651
  const canSend = !p.disabled && (p.canSend ?? p.value.trim() !== "") && (!p.busy || p.sendWhileBusy || !p.onStop);
652
+ const voiceOpts: ChatComposerVoice | null = p.voice ? (p.voice === true ? {} : p.voice) : null;
653
+ const voice = useDictation({
654
+ enabled: !!voiceOpts, text: p.value, onText: p.onChange, lang: voiceOpts?.lang, likelyLang: voiceOpts?.likelyLang, maxLength: p.maxLength,
655
+ silenceMs: voiceOpts?.silenceMs, firstWordsMs: voiceOpts?.firstWordsMs,
656
+ });
657
+ const { cancel: cancelVoice } = voice;
658
+ // The whole box off: the microphone stops with it (and its button is off, in its place).
659
+ useEffect(() => { if (p.disabled) cancelVoice(); }, [p.disabled, cancelVoice]);
623
660
 
624
661
  // One step per commit, before paint: the crowded frame is never seen. Terminates (four places, each pass stops or moves on).
625
662
  useBeforePaint(() => {
@@ -673,13 +710,23 @@ export function ChatComposer(p: ChatComposerProps) {
673
710
  return () => ro.disconnect();
674
711
  }, [p.value, ref]);
675
712
 
676
- const send = () => { if (canSend) p.onSend(p.value); };
713
+ // What is sent is what the box shows: a session still listening stops first, so nothing lands after the message left.
714
+ const send = () => { if (canSend) { cancelVoice(); p.onSend(p.value); } };
677
715
  const showStop = Boolean(p.busy && p.onStop);
678
716
 
679
717
  return (
680
718
  <DensityContext.Provider value={density}>
681
719
  <div ref={boxRef} className={cx("gemboss-ec-input", p.className)} data-density={density}>
682
720
  {p.top}
721
+ {voice.supported ? (
722
+ // Always there once the mic is, its words changed: a screen reader hears "Listening" arrive (a live region mounted
723
+ // with its words is often not read). Empty, it takes no room (chat-voice.css).
724
+ <p className="gemboss-ec-voice" role="status">
725
+ {voice.listening ? (
726
+ <><span className="gemboss-ec-voice-on">{L.listening}</span> {DICTATION_NOTE}</>
727
+ ) : voice.problem ? <span className="gemboss-ec-voice-problem">{voice.problem}</span> : null}
728
+ </p>
729
+ ) : null}
683
730
  <textarea
684
731
  ref={ref as Ref<HTMLTextAreaElement>}
685
732
  value={p.value}
@@ -688,7 +735,8 @@ export function ChatComposer(p: ChatComposerProps) {
688
735
  disabled={p.disabled}
689
736
  aria-label={p.label ?? L.message}
690
737
  placeholder={p.placeholder}
691
- onChange={(e) => p.onChange(e.target.value)}
738
+ // The seller typing while it listens stops it at once (their edit is the box; nothing more lands in it).
739
+ onChange={(e) => { cancelVoice(); p.onChange(e.target.value); }}
692
740
  onPaste={p.onPaste}
693
741
  onKeyDown={(e) => {
694
742
  p.onKeyDown?.(e);
@@ -699,7 +747,20 @@ export function ChatComposer(p: ChatComposerProps) {
699
747
  />
700
748
  <div className="gemboss-ec-toolbar">
701
749
  <div className="gemboss-ec-toolbar-lead">{p.leading}</div>
702
- {p.tools ? <div className="gemboss-ec-toolbar-tools">{p.tools}</div> : null}
750
+ {p.tools || voice.supported ? (
751
+ <div className="gemboss-ec-toolbar-tools">
752
+ {p.tools}
753
+ {voice.supported ? (
754
+ // One label, its state in aria-pressed (a toggle that also renamed itself would be read as two buttons). The note
755
+ // rides in the tooltip, and on the line above the box each time it listens.
756
+ <button type="button" className="gemboss-ec-mic" aria-pressed={voice.listening} aria-label={L.speak}
757
+ title={voice.listening ? L.stopListening : `${L.speak}. ${DICTATION_NOTE}`} disabled={p.disabled || undefined}
758
+ onClick={voice.toggle}>
759
+ <MicIcon />
760
+ </button>
761
+ ) : null}
762
+ </div>
763
+ ) : null}
703
764
  {p.status}
704
765
  {/* Two keys, two nodes: one reused <button> was born with stop's red and faded to grey (the admin, 22/09). */}
705
766
  {showStop ? (
@@ -789,6 +850,8 @@ export interface AssistantChatProps extends Omit<ChatMarkdownProps, "text"> {
789
850
  engine?: ReactNode;
790
851
  /** Tools beside the chips (`ChatAttach`). */
791
852
  tools?: ReactNode;
853
+ /** The composer's microphone (ChatComposer `voice`). */
854
+ voice?: ChatComposerProps["voice"];
792
855
  composerTop?: ReactNode;
793
856
  composerStatus?: ReactNode;
794
857
  maxLength?: number;
@@ -904,7 +967,7 @@ export function AssistantChat(p: AssistantChatProps) {
904
967
  value={draft} onChange={setDraft} onSend={send}
905
968
  busy={p.busy} onStop={p.onStop} sendWhileBusy={p.sendWhileBusy}
906
969
  placeholder={p.placeholder} label={p.inputLabel} maxLength={p.maxLength}
907
- leading={p.engine} tools={p.tools} top={p.composerTop} status={p.composerStatus}
970
+ leading={p.engine} tools={p.tools} voice={p.voice} top={p.composerTop} status={p.composerStatus}
908
971
  textareaRef={inputRef} onKeyDown={p.onComposerKeyDown} onPaste={p.onComposerPaste}
909
972
  />
910
973
  </div>