@burdenoff/fe-libs 2026.1114.15 → 2026.1115.1
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.
- package/dist/shared/assistant/ui/composer/AssistantComposer.js +163 -163
- package/dist/shared/assistant/ui/composer/AssistantMicMenu.d.ts +0 -15
- package/dist/shared/assistant/ui/composer/AssistantMicMenu.js +68 -76
- package/dist/shared/assistant/ui/composer/AssistantModeMenu.js +114 -108
- package/dist/shared-assistant.js +185 -185
- package/dist/ui/dropdown-menu.d.ts +3 -1
- package/dist/ui/dropdown-menu.js +3 -3
- package/package.json +1 -1
- package/src/shared/tokens/tokens.css +16 -0
|
@@ -17,32 +17,32 @@ import { AssistantVoiceButton as se, ListeningDot as ce } from "./AssistantVoice
|
|
|
17
17
|
import { AssistantVoiceSessionButton as le } from "../voice/AssistantVoiceSessionButton.js";
|
|
18
18
|
import { useCompactDictation as ue } from "./useCompactDictation.js";
|
|
19
19
|
import { DictationControls as de, DictationLiveText as fe, MicBlockedNotice as pe } from "./AssistantDictation.js";
|
|
20
|
-
import { AssistantMicMenu as me
|
|
21
|
-
import { AssistantModeSelector as
|
|
22
|
-
import { AssistantModeMenu as
|
|
23
|
-
import { AssistantViewSwitchRow as
|
|
24
|
-
import { compactEnterSends as
|
|
25
|
-
import { PAGE_COLUMN as
|
|
26
|
-
import { useCallback as c, useEffect as l, useId as u, useLayoutEffect as
|
|
27
|
-
import { ArrowUp as
|
|
28
|
-
import { Fragment as
|
|
20
|
+
import { AssistantMicMenu as me } from "./AssistantMicMenu.js";
|
|
21
|
+
import { AssistantModeSelector as he } from "./AssistantModeSelector.js";
|
|
22
|
+
import { AssistantModeMenu as ge } from "./AssistantModeMenu.js";
|
|
23
|
+
import { AssistantViewSwitchRow as _e } from "../compact/AssistantViewSwitchRow.js";
|
|
24
|
+
import { compactEnterSends as ve, isImeComposingEnter as ye } from "./imeEnter.js";
|
|
25
|
+
import { PAGE_COLUMN as be, useAssistantPageLayout as xe } from "../assistantPageLayout.js";
|
|
26
|
+
import { useCallback as c, useEffect as l, useId as u, useLayoutEffect as Se, useMemo as Ce, useRef as d, useState as f } from "react";
|
|
27
|
+
import { ArrowUp as we, Loader2 as p, Square as Te } from "lucide-react";
|
|
28
|
+
import { Fragment as Ee, jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
29
29
|
// src/shared/assistant/ui/composer/AssistantComposer.tsx
|
|
30
|
-
var
|
|
31
|
-
function
|
|
30
|
+
var De = 200;
|
|
31
|
+
function Oe(e) {
|
|
32
32
|
if (!e) return !1;
|
|
33
33
|
let t = e.ownerDocument.activeElement;
|
|
34
34
|
return !t || t === e.ownerDocument.body ? !1 : e.contains(t) ? !0 : e.closest("[data-assistant-panel]")?.contains(t) ?? !1;
|
|
35
35
|
}
|
|
36
|
-
var
|
|
37
|
-
let S = r(), C =
|
|
36
|
+
var ke = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend: g, disabled: Ae = !1, readOnly: je = !1, placeholder: Me, mode: Ne, availableModes: _, attachmentCharsPerFile: Pe, onModeChange: Fe, auto: Ie, onStartVoiceSession: v, onDraftStart: Le, onDraftChange: Re, suspendDictation: ze = !1, onVoiceStateChange: Be, presentation: Ve = "classic", turnInFlight: y = !1, onStop: He, turnId: Ue, modeDisabledReason: We = null, inputRef: b, aboveCard: Ge, viewSwitch: Ke, modeReadOnly: qe = !1, voiceSessionActive: x = !1, concealed: Je = !1 }) => {
|
|
37
|
+
let S = r(), C = xe(), { locale: w } = n(), T = Ae || je, E = Ve === "compact", D = d(null), Ye = c((e) => {
|
|
38
38
|
D.current = e, typeof b == "function" ? b(e) : b && (b.current = e);
|
|
39
|
-
}, [b]), [O, k] = f(""), [A,
|
|
40
|
-
|
|
41
|
-
let
|
|
39
|
+
}, [b]), [O, k] = f(""), [A, Xe] = f(!1), [j, Ze] = f(!1), Qe = d(!1), [M, N] = f(null), [$e, P] = f(null), [F, I] = f(null), [et, tt] = f(y);
|
|
40
|
+
et === y ? F !== null && y && Ue != null && Ue !== F && I(null) : (tt(y), y ? (P(null), I(null)) : F !== null && (P(F), I(null)));
|
|
41
|
+
let nt = d(!1), rt = d(null), it = d(!1), at = d(!1), ot = d(null), st = d(!1), L = d(0), { attachments: R, isBusy: ct, preparingCount: lt, sendBlocker: ut, rejection: dt, addFiles: z, remove: ft, retry: pt, clear: mt, clearRejection: ht, canAddMore: gt, commit: _t, cancelCommit: vt } = ee({ perFileChars: Pe }), B = O.trim() !== "" || R.length > 0, yt = d(!1), V = d(!1);
|
|
42
42
|
l(() => {
|
|
43
|
-
B && !
|
|
44
|
-
}, [B,
|
|
45
|
-
B || (V.current = !1),
|
|
43
|
+
B && !yt.current ? (yt.current = !0, Le?.()) : B || (yt.current = !1);
|
|
44
|
+
}, [B, Le]), l(() => {
|
|
45
|
+
B || (V.current = !1), Re?.({
|
|
46
46
|
text: O,
|
|
47
47
|
hasAttachments: R.length > 0,
|
|
48
48
|
dictated: V.current
|
|
@@ -51,16 +51,16 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
51
51
|
O,
|
|
52
52
|
R.length,
|
|
53
53
|
B,
|
|
54
|
-
|
|
54
|
+
Re
|
|
55
55
|
]);
|
|
56
56
|
let H = c((e) => {
|
|
57
57
|
V.current = !0, k((t) => t ? `${t.replace(/\s+$/, "")} ${e}` : e);
|
|
58
|
-
}, []),
|
|
59
|
-
onFinalize: (e) =>
|
|
60
|
-
onEnded: () =>
|
|
61
|
-
language:
|
|
62
|
-
deviceId:
|
|
63
|
-
}),
|
|
58
|
+
}, []), bt = o((e) => e.assistantLanguage), xt = Ce(() => a(bt, w), [bt, w]), St = d(H), Ct = d(() => void 0), wt = o((e) => e.micDeviceId), U = s({
|
|
59
|
+
onFinalize: (e) => St.current(e),
|
|
60
|
+
onEnded: () => Ct.current(),
|
|
61
|
+
language: xt.tag,
|
|
62
|
+
deviceId: wt
|
|
63
|
+
}), Tt = c(() => {
|
|
64
64
|
V.current = !0;
|
|
65
65
|
}, []), W = ue({
|
|
66
66
|
enabled: E,
|
|
@@ -68,75 +68,75 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
68
68
|
text: O,
|
|
69
69
|
setText: k,
|
|
70
70
|
textareaRef: D,
|
|
71
|
-
markDictated:
|
|
72
|
-
deviceId:
|
|
73
|
-
}),
|
|
71
|
+
markDictated: Tt,
|
|
72
|
+
deviceId: wt
|
|
73
|
+
}), Et = W.addFinal;
|
|
74
74
|
l(() => {
|
|
75
|
-
|
|
75
|
+
St.current = E ? Et : H;
|
|
76
76
|
}, [
|
|
77
77
|
E,
|
|
78
|
-
|
|
78
|
+
Et,
|
|
79
79
|
H
|
|
80
80
|
]);
|
|
81
|
-
let
|
|
81
|
+
let Dt = W.recogniserEnded;
|
|
82
82
|
l(() => {
|
|
83
|
-
|
|
84
|
-
}, [E,
|
|
85
|
-
let G = U.isActive,
|
|
83
|
+
Ct.current = E ? Dt : () => void 0;
|
|
84
|
+
}, [E, Dt]);
|
|
85
|
+
let G = U.isActive, Ot = U.interim, kt = U.stop, At = W.keepAndStop;
|
|
86
86
|
l(() => {
|
|
87
|
-
|
|
87
|
+
ze && G && (E ? At() : (Ot.trim() !== "" && H(Ot.trim()), kt()));
|
|
88
88
|
}, [
|
|
89
|
-
|
|
89
|
+
ze,
|
|
90
90
|
G,
|
|
91
|
-
|
|
92
|
-
|
|
91
|
+
Ot,
|
|
92
|
+
kt,
|
|
93
93
|
H,
|
|
94
94
|
E,
|
|
95
|
-
|
|
95
|
+
At
|
|
96
96
|
]), l(() => {
|
|
97
|
-
|
|
97
|
+
Be?.({
|
|
98
98
|
committing: j,
|
|
99
99
|
dictating: G
|
|
100
100
|
});
|
|
101
101
|
}, [
|
|
102
|
-
|
|
102
|
+
Be,
|
|
103
103
|
j,
|
|
104
104
|
G
|
|
105
105
|
]);
|
|
106
|
-
let
|
|
106
|
+
let jt = oe((e) => e.pending), Mt = jt ? S("askAbout.placeholder", "Ask about {{name}}…", { name: jt.label }) : Me ?? S("composer.placeholder", "Ask me anything…"), Nt = oe((e) => e.focusRequested), Pt = (e) => {
|
|
107
107
|
k(e), requestAnimationFrame(() => {
|
|
108
108
|
let t = D.current;
|
|
109
109
|
t && (t.focus({ preventScroll: !0 }), t.setSelectionRange(e.length, e.length));
|
|
110
110
|
});
|
|
111
111
|
};
|
|
112
112
|
l(() => {
|
|
113
|
-
if (!
|
|
113
|
+
if (!Nt || T) return;
|
|
114
114
|
let e = D.current;
|
|
115
115
|
e && (e.focus({ preventScroll: !0 }), oe.getState().actions.composerFocused());
|
|
116
|
-
}, [
|
|
117
|
-
let K = O.trim(), q = te(R),
|
|
118
|
-
|
|
116
|
+
}, [Nt, T]);
|
|
117
|
+
let K = O.trim(), q = te(R), Ft = R.filter((e) => e.status === "error"), J = (K.length > 0 || q.length > 0) && !T && !j && ut === null, It = q.some((e) => !(e.fileId && e.downloadUrl) && !e.inlineOnly), Lt = d(T);
|
|
118
|
+
Lt.current = T;
|
|
119
119
|
let Y = d(!0);
|
|
120
120
|
l(() => (Y.current = !0, () => {
|
|
121
121
|
Y.current = !1;
|
|
122
|
-
}), []),
|
|
122
|
+
}), []), Se(() => {
|
|
123
123
|
let e = D.current;
|
|
124
|
-
e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight,
|
|
124
|
+
e && (e.style.height = "auto", e.style.height = `${Math.min(e.scrollHeight, De)}px`);
|
|
125
125
|
}, [O]);
|
|
126
126
|
let X = c(async () => {
|
|
127
|
-
if (!J ||
|
|
127
|
+
if (!J || Qe.current) return;
|
|
128
128
|
U.isActive && U.stop();
|
|
129
129
|
let e = O.trim();
|
|
130
130
|
N(null);
|
|
131
|
-
let t = E &&
|
|
132
|
-
if (!
|
|
133
|
-
|
|
131
|
+
let t = E && Oe(ot.current);
|
|
132
|
+
if (!It) {
|
|
133
|
+
st.current = t, g(e, q), k(""), mt();
|
|
134
134
|
return;
|
|
135
135
|
}
|
|
136
136
|
let n = o.getState().activeConversationId;
|
|
137
|
-
|
|
137
|
+
Qe.current = !0, Ze(!0);
|
|
138
138
|
try {
|
|
139
|
-
let r = await
|
|
139
|
+
let r = await _t();
|
|
140
140
|
if (!Y.current) {
|
|
141
141
|
r.ok && await r.rollback();
|
|
142
142
|
return;
|
|
@@ -148,7 +148,7 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
148
148
|
});
|
|
149
149
|
return;
|
|
150
150
|
}
|
|
151
|
-
if (
|
|
151
|
+
if (Lt.current) {
|
|
152
152
|
await r.rollback(), Y.current && N({
|
|
153
153
|
kind: "busy",
|
|
154
154
|
failures: []
|
|
@@ -163,60 +163,60 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
163
163
|
});
|
|
164
164
|
return;
|
|
165
165
|
}
|
|
166
|
-
|
|
166
|
+
st.current = t, g(e, te(r.attachments)), r.handedOver(), k(""), mt();
|
|
167
167
|
} finally {
|
|
168
|
-
|
|
168
|
+
Qe.current = !1, Y.current && Ze(!1);
|
|
169
169
|
}
|
|
170
170
|
}, [
|
|
171
171
|
J,
|
|
172
|
-
|
|
173
|
-
|
|
172
|
+
It,
|
|
173
|
+
_t,
|
|
174
174
|
g,
|
|
175
175
|
O,
|
|
176
176
|
q,
|
|
177
|
-
|
|
177
|
+
mt,
|
|
178
178
|
U,
|
|
179
179
|
E
|
|
180
|
-
]),
|
|
181
|
-
|
|
182
|
-
}, [
|
|
183
|
-
|
|
184
|
-
}, []),
|
|
185
|
-
if (
|
|
186
|
-
let e =
|
|
187
|
-
e !== null && (
|
|
188
|
-
}, [
|
|
180
|
+
]), Rt = c(() => {
|
|
181
|
+
vt(), D.current?.focus();
|
|
182
|
+
}, [vt]), Z = c(() => {
|
|
183
|
+
Lt.current ? nt.current = !0 : D.current?.focus();
|
|
184
|
+
}, []), zt = c(() => {
|
|
185
|
+
if (at.current) return;
|
|
186
|
+
let e = He?.() ?? null;
|
|
187
|
+
e !== null && (at.current = !0, I(e)), Z();
|
|
188
|
+
}, [He, Z]);
|
|
189
189
|
l(() => {
|
|
190
|
-
!T &&
|
|
190
|
+
!T && nt.current && (nt.current = !1, D.current?.focus());
|
|
191
191
|
}, [T]);
|
|
192
|
-
let
|
|
192
|
+
let Bt = c((e) => {
|
|
193
193
|
if (e !== null) {
|
|
194
|
-
|
|
194
|
+
rt.current = e;
|
|
195
195
|
return;
|
|
196
196
|
}
|
|
197
|
-
let t =
|
|
198
|
-
|
|
199
|
-
}, []), Q = E && y &&
|
|
200
|
-
|
|
201
|
-
!Q &&
|
|
197
|
+
let t = rt.current;
|
|
198
|
+
rt.current = null, t !== null && t.ownerDocument.activeElement === t && (it.current = !0);
|
|
199
|
+
}, []), Q = E && y && He !== void 0;
|
|
200
|
+
Se(() => {
|
|
201
|
+
!Q && it.current && (it.current = !1, Z());
|
|
202
202
|
}, [Q, Z]), l(() => {
|
|
203
|
-
F === null && (
|
|
204
|
-
}, [F]),
|
|
203
|
+
F === null && (at.current = !1);
|
|
204
|
+
}, [F]), Se(() => {
|
|
205
205
|
if (!Q) return;
|
|
206
|
-
let e =
|
|
207
|
-
if (
|
|
208
|
-
let t =
|
|
206
|
+
let e = st.current;
|
|
207
|
+
if (st.current = !1, !e) return;
|
|
208
|
+
let t = rt.current;
|
|
209
209
|
if (t === null) return;
|
|
210
210
|
let n = t.ownerDocument, r = n.activeElement;
|
|
211
211
|
(r === null || r === n.body || r === D.current) && t.focus({ preventScroll: !0 });
|
|
212
212
|
}, [Q]);
|
|
213
|
-
let
|
|
213
|
+
let Vt = c((e) => {
|
|
214
214
|
k(e), P(null);
|
|
215
215
|
}, []);
|
|
216
216
|
l(() => {
|
|
217
217
|
N(null);
|
|
218
218
|
}, [R.length]);
|
|
219
|
-
let
|
|
219
|
+
let Ht = (t) => {
|
|
220
220
|
if (t.kind === "busy") return S("attachments.saveBusy", "The assistant started another reply, so nothing was sent. Your message and files are still here.");
|
|
221
221
|
if (t.kind === "moved") return S("attachments.saveMoved", "You switched conversations while the files were being saved, so nothing was sent. Your message and files are still here.");
|
|
222
222
|
let { failures: n } = t;
|
|
@@ -224,22 +224,22 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
224
224
|
if (n.some((e) => e.code === ne.quotaExceeded || e.code === ne.quotaNotProvisioned)) return `${S("attachments.quotaFull", "File storage is full or not set up for this workspace, so the attachments couldn't be saved. Nothing was sent.")} ${S("attachments.retrySend", "Press Send to try again, or remove the file.")}`;
|
|
225
225
|
let r = n[0], i = R.find((e) => e.id === r?.id)?.filename ?? "";
|
|
226
226
|
return `${n.length <= 1 ? S("attachments.saveFailedOne", "{{name}} couldn't be saved, so nothing was sent.", { name: i }) : S("attachments.saveFailedMany", "{{count}} attachments couldn't be saved, so nothing was sent.", { count: n.length })} ${S("attachments.retrySend", "Press Send to try again, or remove the file.")}`;
|
|
227
|
-
},
|
|
227
|
+
}, Ut = c((e) => {
|
|
228
228
|
e.key === "Enter" && !e.shiftKey && (e.preventDefault(), X());
|
|
229
|
-
}, [X]),
|
|
230
|
-
e.key === "Escape" ?
|
|
231
|
-
}, [X]),
|
|
229
|
+
}, [X]), Wt = c((e) => {
|
|
230
|
+
e.key === "Escape" ? ye(e) && e.stopPropagation() : ve(e) && (e.preventDefault(), P(null), X());
|
|
231
|
+
}, [X]), Gt = c((e) => {
|
|
232
232
|
let t = Array.from(e.clipboardData?.files ?? []);
|
|
233
233
|
t.length !== 0 && (e.preventDefault(), z(t));
|
|
234
|
-
}, [z]),
|
|
235
|
-
Array.from(e.dataTransfer?.types ?? []).includes("Files") && (L.current += 1,
|
|
236
|
-
}, []),
|
|
237
|
-
L.current = Math.max(0, L.current - 1), L.current === 0 &&
|
|
238
|
-
}, []),
|
|
234
|
+
}, [z]), Kt = c((e) => {
|
|
235
|
+
Array.from(e.dataTransfer?.types ?? []).includes("Files") && (L.current += 1, Xe(!0));
|
|
236
|
+
}, []), qt = c(() => {
|
|
237
|
+
L.current = Math.max(0, L.current - 1), L.current === 0 && Xe(!1);
|
|
238
|
+
}, []), Jt = c((e) => {
|
|
239
239
|
Array.from(e.dataTransfer?.types ?? []).includes("Files") && e.preventDefault();
|
|
240
|
-
}, []),
|
|
241
|
-
e.preventDefault(), L.current = 0,
|
|
242
|
-
}, [z]),
|
|
240
|
+
}, []), Yt = c((e) => {
|
|
241
|
+
e.preventDefault(), L.current = 0, Xe(!1), z(e.dataTransfer?.files ?? null);
|
|
242
|
+
}, [z]), Xt = (e) => {
|
|
243
243
|
switch (e) {
|
|
244
244
|
case "too-many": return S("attachments.tooMany", "You can attach up to {{max}} files per message.", { max: 5 });
|
|
245
245
|
case "too-large": return S("attachments.tooLarge", "That file is larger than 10 MB.");
|
|
@@ -257,8 +257,8 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
257
257
|
case "unknown": return S("voice.failed", "Dictation stopped unexpectedly.");
|
|
258
258
|
default: return null;
|
|
259
259
|
}
|
|
260
|
-
})(),
|
|
261
|
-
onDismiss:
|
|
260
|
+
})(), Zt = (e, n, r = !1) => j ? /* @__PURE__ */ m(t, {
|
|
261
|
+
onDismiss: Rt,
|
|
262
262
|
children: /* @__PURE__ */ h("p", {
|
|
263
263
|
className: "flex items-center justify-center gap-2 text-text-muted",
|
|
264
264
|
"data-testid": "assistant-commit-status",
|
|
@@ -270,7 +270,7 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
270
270
|
/* @__PURE__ */ m("span", { children: S("attachments.saving", "Saving your attachments…") }),
|
|
271
271
|
/* @__PURE__ */ m("button", {
|
|
272
272
|
type: "button",
|
|
273
|
-
onClick:
|
|
273
|
+
onClick: Rt,
|
|
274
274
|
className: "rounded text-text-primary underline underline-offset-2 hover:text-action-primary-bg focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong",
|
|
275
275
|
"data-testid": "assistant-commit-cancel",
|
|
276
276
|
children: S("attachments.cancelSaving", "Cancel")
|
|
@@ -281,7 +281,7 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
281
281
|
className: "text-status-error-text",
|
|
282
282
|
role: "alert",
|
|
283
283
|
"data-testid": "assistant-commit-failed",
|
|
284
|
-
children:
|
|
284
|
+
children: Ht(M)
|
|
285
285
|
}) : !r && U.isStarting && !U.isListening ? /* @__PURE__ */ m("p", {
|
|
286
286
|
className: "text-text-muted",
|
|
287
287
|
"data-testid": "assistant-voice-starting",
|
|
@@ -294,16 +294,16 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
294
294
|
className: "text-status-error-text",
|
|
295
295
|
"data-testid": "assistant-voice-error",
|
|
296
296
|
children: $
|
|
297
|
-
}) :
|
|
297
|
+
}) : dt ? /* @__PURE__ */ m("button", {
|
|
298
298
|
type: "button",
|
|
299
|
-
onClick:
|
|
299
|
+
onClick: ht,
|
|
300
300
|
className: "text-status-error-text underline-offset-2 hover:underline",
|
|
301
301
|
"data-testid": "assistant-attachment-rejection",
|
|
302
|
-
children:
|
|
303
|
-
}) :
|
|
302
|
+
children: Xt(dt)
|
|
303
|
+
}) : ut === "failed" ? /* @__PURE__ */ m("p", {
|
|
304
304
|
className: "text-status-error-text",
|
|
305
305
|
"data-testid": "assistant-attachment-blocked",
|
|
306
|
-
children:
|
|
306
|
+
children: Ft.length === 1 ? S("attachments.blockedOne", "{{name}} didn't upload. Retry or remove it before sending.", { name: Ft[0].filename }) : S("attachments.blockedMany", "{{count}} attachments didn't upload. Retry or remove them before sending.", { count: Ft.length })
|
|
307
307
|
}) : n ? /* @__PURE__ */ m("p", {
|
|
308
308
|
className: "text-text-muted",
|
|
309
309
|
"data-testid": "assistant-stopping-status",
|
|
@@ -317,15 +317,15 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
317
317
|
children: S("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach")
|
|
318
318
|
});
|
|
319
319
|
if (E) {
|
|
320
|
-
let e = v !== void 0 && K.length === 0 && R.length === 0 && !U.isActive, n = S("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach"), r = U.isSupported && !x && W.phase !== "idle", i = U.error === "not-allowed" || U.error === "audio-capture", a = !!(j || M || $ ||
|
|
321
|
-
return /* @__PURE__ */ m(
|
|
322
|
-
ref:
|
|
323
|
-
className: `${C ? `flex-shrink-0 px-3 pt-1.5 ${
|
|
320
|
+
let e = v !== void 0 && K.length === 0 && R.length === 0 && !U.isActive, n = S("composer.hint", "Enter to send · Shift+Enter for newline · drag or paste files to attach"), r = U.isSupported && !x && W.phase !== "idle", i = U.error === "not-allowed" || U.error === "audio-capture", a = !!(j || M || $ || dt || ut === "failed" || $e !== null || F !== null), o = W.nothingHeard && !a, s = "focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] focus-visible:ring-offset-2 focus-visible:ring-offset-[var(--color-bg-elevated)]";
|
|
321
|
+
return /* @__PURE__ */ m(ke, { children: (ee) => /* @__PURE__ */ h("div", {
|
|
322
|
+
ref: ot,
|
|
323
|
+
className: `${C ? `flex-shrink-0 px-3 pt-1.5 ${be}` : "flex-shrink-0 px-3 pt-1.5"}${Je ? " hidden" : ""}`,
|
|
324
324
|
children: [
|
|
325
|
-
|
|
326
|
-
|
|
325
|
+
Ge,
|
|
326
|
+
Ke ? /* @__PURE__ */ m(_e, {
|
|
327
327
|
voiceLive: x,
|
|
328
|
-
children:
|
|
328
|
+
children: Ke
|
|
329
329
|
}) : null,
|
|
330
330
|
/* @__PURE__ */ h("div", {
|
|
331
331
|
className: a || o || u ? "mb-1.5 px-1 text-center text-xs" : "",
|
|
@@ -346,7 +346,7 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
346
346
|
className: "text-text-secondary",
|
|
347
347
|
"data-testid": "assistant-dictation-nothing-heard",
|
|
348
348
|
children: S("dictation.nothingHeard", "Nothing was heard. Check the microphone and try again.")
|
|
349
|
-
}) : a ? $
|
|
349
|
+
}) : a ? Zt($e !== null, F !== null, !0) : null,
|
|
350
350
|
r && U.isListening ? /* @__PURE__ */ m("span", {
|
|
351
351
|
className: "sr-only",
|
|
352
352
|
"data-testid": "assistant-dictation-announced",
|
|
@@ -361,41 +361,41 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
361
361
|
children: n
|
|
362
362
|
}),
|
|
363
363
|
/* @__PURE__ */ h("div", {
|
|
364
|
-
onDragEnter:
|
|
365
|
-
onDragLeave:
|
|
366
|
-
onDragOver:
|
|
367
|
-
onDrop:
|
|
368
|
-
className: `flex flex-col rounded-3xl border transition-colors ${r && W.phase === "listening" ? "border-status-warning-bg ring-1 ring-status-warning-bg" : "focus-within:border-[var(--color-focus-ring)] focus-within:ring-1 focus-within:ring-[var(--color-focus-ring)]"} ${
|
|
364
|
+
onDragEnter: Kt,
|
|
365
|
+
onDragLeave: qt,
|
|
366
|
+
onDragOver: Jt,
|
|
367
|
+
onDrop: Yt,
|
|
368
|
+
className: `flex flex-col rounded-3xl border transition-colors ${r && W.phase === "listening" ? "border-status-warning-bg ring-1 ring-status-warning-bg" : "focus-within:border-[var(--color-focus-ring)] focus-within:ring-1 focus-within:ring-[var(--color-focus-ring)]"} ${qe ? "bg-bg-surface" : "bg-bg-elevated"} ${r && W.phase !== "transcribing" ? "" : A ? "border-dashed border-[var(--color-focus-ring)]" : "border-[var(--color-text-muted)]"}`,
|
|
369
369
|
"data-dictating": r ? W.phase : void 0,
|
|
370
370
|
"data-testid": "assistant-composer",
|
|
371
371
|
"data-presentation": "compact",
|
|
372
372
|
children: [
|
|
373
373
|
/* @__PURE__ */ m("div", {
|
|
374
374
|
className: "px-3 pt-3 empty:hidden",
|
|
375
|
-
children: /* @__PURE__ */ h(
|
|
375
|
+
children: /* @__PURE__ */ h(Ee, { children: [/* @__PURE__ */ m(ae, {
|
|
376
376
|
disabled: j,
|
|
377
377
|
showSuggestions: K.length === 0,
|
|
378
|
-
onSuggest:
|
|
378
|
+
onSuggest: Pt
|
|
379
379
|
}), /* @__PURE__ */ m(ie, {
|
|
380
380
|
attachments: R,
|
|
381
|
-
onRemove:
|
|
382
|
-
onRetry:
|
|
381
|
+
onRemove: ft,
|
|
382
|
+
onRetry: pt,
|
|
383
383
|
disabled: T || j,
|
|
384
|
-
preparingCount:
|
|
384
|
+
preparingCount: lt
|
|
385
385
|
})] })
|
|
386
386
|
}),
|
|
387
387
|
/* @__PURE__ */ m("textarea", {
|
|
388
|
-
ref:
|
|
388
|
+
ref: Ye,
|
|
389
389
|
value: O,
|
|
390
|
-
onChange: (e) =>
|
|
391
|
-
onKeyDown:
|
|
392
|
-
onPaste:
|
|
390
|
+
onChange: (e) => Vt(e.target.value),
|
|
391
|
+
onKeyDown: Wt,
|
|
392
|
+
onPaste: Gt,
|
|
393
393
|
disabled: T,
|
|
394
394
|
readOnly: j,
|
|
395
395
|
"aria-busy": j || void 0,
|
|
396
|
-
placeholder: A ? S("composer.dropHere", "Drop files to attach") :
|
|
396
|
+
placeholder: A ? S("composer.dropHere", "Drop files to attach") : Mt,
|
|
397
397
|
rows: 1,
|
|
398
|
-
className: `min-h-10 w-
|
|
398
|
+
className: `scrollbar-slim scrollbar-box min-h-10 w-[calc(100%-0.375rem)] resize-none bg-transparent pb-1 pe-2.5 ps-4 pt-3 text-base leading-6 text-text-primary placeholder:text-text-muted focus:outline-none disabled:opacity-50${r ? " hidden" : ""}`,
|
|
399
399
|
"aria-describedby": ee,
|
|
400
400
|
title: n,
|
|
401
401
|
"aria-label": S("chatInput.ariaLabel", "Message input"),
|
|
@@ -434,25 +434,25 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
434
434
|
children: [
|
|
435
435
|
/* @__PURE__ */ m(re, {
|
|
436
436
|
onFiles: z,
|
|
437
|
-
canAddMore:
|
|
437
|
+
canAddMore: gt,
|
|
438
438
|
disabled: T || j,
|
|
439
439
|
compact: !0,
|
|
440
440
|
capMenuHeight: !0
|
|
441
441
|
}),
|
|
442
|
-
/* @__PURE__ */ m(
|
|
442
|
+
/* @__PURE__ */ m(ge, {
|
|
443
443
|
chip: !0,
|
|
444
|
-
readOnly:
|
|
445
|
-
mode:
|
|
444
|
+
readOnly: qe,
|
|
445
|
+
mode: Ne,
|
|
446
446
|
availableModes: _,
|
|
447
|
-
onModeChange:
|
|
448
|
-
auto:
|
|
447
|
+
onModeChange: Fe,
|
|
448
|
+
auto: Ie,
|
|
449
449
|
disabled: T || j,
|
|
450
|
-
disabledReason: F === null ? y ? "replying" :
|
|
450
|
+
disabledReason: F === null ? y ? "replying" : We ?? "busy" : "busy"
|
|
451
451
|
}),
|
|
452
|
-
C ? /* @__PURE__ */ m("span", {
|
|
452
|
+
C && i ? /* @__PURE__ */ m("span", {
|
|
453
453
|
className: "ms-1 hidden min-w-0 truncate text-xs text-text-secondary sm:block",
|
|
454
454
|
"data-testid": "assistant-mic-summary",
|
|
455
|
-
children:
|
|
455
|
+
children: S("dictation.noMicrophone", "No microphone available")
|
|
456
456
|
}) : null,
|
|
457
457
|
/* @__PURE__ */ m("div", { className: "min-w-0 flex-1" }),
|
|
458
458
|
U.isSupported && !x ? C ? /* @__PURE__ */ m(me, {
|
|
@@ -467,16 +467,16 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
467
467
|
disabled: T || j
|
|
468
468
|
}) : null,
|
|
469
469
|
Q ? /* @__PURE__ */ m("button", {
|
|
470
|
-
ref:
|
|
470
|
+
ref: Bt,
|
|
471
471
|
type: "button",
|
|
472
|
-
onClick:
|
|
472
|
+
onClick: zt,
|
|
473
473
|
className: `flex size-11 sm:size-10 flex-shrink-0 items-center justify-center rounded-full bg-action-primary-bg text-action-primary-text transition-colors hover:bg-action-primary-bg-hover ${s} ${F === null ? "" : "cursor-default opacity-60"}`,
|
|
474
474
|
"aria-label": F === null ? S("composer.stop", "Stop the reply") : S("composer.stopping", "Stopping the reply…"),
|
|
475
475
|
title: F === null ? S("composer.stop", "Stop the reply") : S("composer.stopping", "Stopping the reply…"),
|
|
476
476
|
"aria-disabled": F === null ? void 0 : "true",
|
|
477
477
|
"aria-busy": F === null ? void 0 : "true",
|
|
478
478
|
"data-testid": "assistant-stop",
|
|
479
|
-
children: F === null ? /* @__PURE__ */ m(
|
|
479
|
+
children: F === null ? /* @__PURE__ */ m(Te, {
|
|
480
480
|
className: "size-4 fill-current",
|
|
481
481
|
"aria-hidden": "true"
|
|
482
482
|
}) : /* @__PURE__ */ m(p, {
|
|
@@ -497,10 +497,10 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
497
497
|
className: `flex size-11 sm:size-10 flex-shrink-0 items-center justify-center rounded-full transition-colors ${s} ${J ? "bg-action-primary-bg text-action-primary-text hover:bg-action-primary-bg-hover" : "bg-[var(--color-bg-disabled)] text-[var(--color-text-disabled)]"}`,
|
|
498
498
|
"aria-label": S("chatInput.send", "Send message"),
|
|
499
499
|
"data-testid": "assistant-send",
|
|
500
|
-
children:
|
|
500
|
+
children: Ae || ct || j ? /* @__PURE__ */ m(p, {
|
|
501
501
|
className: "size-5 motion-safe:animate-spin",
|
|
502
502
|
"aria-hidden": "true"
|
|
503
|
-
}) : /* @__PURE__ */ m(
|
|
503
|
+
}) : /* @__PURE__ */ m(we, {
|
|
504
504
|
className: "size-5",
|
|
505
505
|
"aria-hidden": "true"
|
|
506
506
|
})
|
|
@@ -516,30 +516,30 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
516
516
|
className: "flex-shrink-0 px-3 pb-3 pt-1.5",
|
|
517
517
|
children: [
|
|
518
518
|
/* @__PURE__ */ h("div", {
|
|
519
|
-
onDragEnter:
|
|
520
|
-
onDragLeave:
|
|
521
|
-
onDragOver:
|
|
522
|
-
onDrop:
|
|
519
|
+
onDragEnter: Kt,
|
|
520
|
+
onDragLeave: qt,
|
|
521
|
+
onDragOver: Jt,
|
|
522
|
+
onDrop: Yt,
|
|
523
523
|
className: `rounded-2xl border p-2 shadow-sm transition-colors focus-within:border-action-primary-bg focus-within:ring-2 focus-within:ring-action-primary-bg/15 ${A ? "border-action-primary-bg border-dashed bg-action-primary-bg/5" : "border-border-default bg-bg-sunken"}`,
|
|
524
524
|
"data-testid": "assistant-composer",
|
|
525
525
|
children: [
|
|
526
|
-
/* @__PURE__ */ h(
|
|
526
|
+
/* @__PURE__ */ h(Ee, { children: [/* @__PURE__ */ m(ae, {
|
|
527
527
|
disabled: j,
|
|
528
528
|
showSuggestions: K.length === 0,
|
|
529
|
-
onSuggest:
|
|
529
|
+
onSuggest: Pt
|
|
530
530
|
}), /* @__PURE__ */ m(ie, {
|
|
531
531
|
attachments: R,
|
|
532
|
-
onRemove:
|
|
533
|
-
onRetry:
|
|
532
|
+
onRemove: ft,
|
|
533
|
+
onRetry: pt,
|
|
534
534
|
disabled: T || j,
|
|
535
|
-
preparingCount:
|
|
535
|
+
preparingCount: lt
|
|
536
536
|
})] }),
|
|
537
537
|
/* @__PURE__ */ h("div", {
|
|
538
538
|
className: "flex items-end gap-2",
|
|
539
539
|
children: [
|
|
540
540
|
/* @__PURE__ */ m(re, {
|
|
541
541
|
onFiles: z,
|
|
542
|
-
canAddMore:
|
|
542
|
+
canAddMore: gt,
|
|
543
543
|
disabled: T || j,
|
|
544
544
|
showLabel: !0
|
|
545
545
|
}),
|
|
@@ -547,12 +547,12 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
547
547
|
ref: D,
|
|
548
548
|
value: O,
|
|
549
549
|
onChange: (e) => k(e.target.value),
|
|
550
|
-
onKeyDown:
|
|
551
|
-
onPaste:
|
|
550
|
+
onKeyDown: Ut,
|
|
551
|
+
onPaste: Gt,
|
|
552
552
|
disabled: T,
|
|
553
553
|
readOnly: j,
|
|
554
554
|
"aria-busy": j || void 0,
|
|
555
|
-
placeholder: A ? S("composer.dropHere", "Drop files to attach") :
|
|
555
|
+
placeholder: A ? S("composer.dropHere", "Drop files to attach") : Mt,
|
|
556
556
|
rows: 1,
|
|
557
557
|
className: "min-h-[36px] flex-1 resize-none self-center bg-transparent px-1 py-2 text-[15px] leading-relaxed text-text-primary placeholder:text-text-muted focus:outline-none disabled:opacity-50",
|
|
558
558
|
"aria-label": S("chatInput.ariaLabel", "Message input"),
|
|
@@ -574,18 +574,18 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
574
574
|
className: `flex size-9 flex-shrink-0 items-center justify-center rounded-full shadow-sm transition-all focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong ${J ? "bg-action-primary-bg text-action-primary-text hover:scale-105 hover:bg-action-primary-bg-hover" : "bg-bg-elevated text-text-muted"}`,
|
|
575
575
|
"aria-label": S("chatInput.send", "Send message"),
|
|
576
576
|
"data-testid": "assistant-send",
|
|
577
|
-
children:
|
|
577
|
+
children: Ae || ct || j ? /* @__PURE__ */ m(p, { className: "size-4 motion-safe:animate-spin" }) : /* @__PURE__ */ m(we, { className: "size-4" })
|
|
578
578
|
})
|
|
579
579
|
]
|
|
580
580
|
}),
|
|
581
581
|
(_.length > 1 || _.some((e) => e.writeCapable)) && /* @__PURE__ */ m("div", {
|
|
582
582
|
className: "mt-2 px-0.5",
|
|
583
|
-
children: /* @__PURE__ */ m(
|
|
584
|
-
mode:
|
|
583
|
+
children: /* @__PURE__ */ m(he, {
|
|
584
|
+
mode: Ne,
|
|
585
585
|
availableModes: _,
|
|
586
|
-
onModeChange:
|
|
586
|
+
onModeChange: Fe,
|
|
587
587
|
disabled: T || j,
|
|
588
|
-
auto:
|
|
588
|
+
auto: Ie
|
|
589
589
|
})
|
|
590
590
|
})
|
|
591
591
|
]
|
|
@@ -598,7 +598,7 @@ var Ae = ({ children: e }) => e(u()), g = ({ writeAccessDenied: u = !1, onSend:
|
|
|
598
598
|
/* @__PURE__ */ m("div", {
|
|
599
599
|
className: "mt-1.5 px-1 text-center text-[11px]",
|
|
600
600
|
"aria-live": "polite",
|
|
601
|
-
children:
|
|
601
|
+
children: Zt(!1, !1)
|
|
602
602
|
})
|
|
603
603
|
]
|
|
604
604
|
});
|
|
@@ -1,19 +1,4 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
-
/**
|
|
3
|
-
* The mic in the message box on a page, as one split control (BOFF-13461; the
|
|
4
|
-
* operator's design of 14 Nov, "Dictation states" 1): the microphone starts
|
|
5
|
-
* dictation, and the arrow beside it opens the microphone and language options.
|
|
6
|
-
* Both choices are remembered (the assistant store) and used by dictation AND the
|
|
7
|
-
* voice chat.
|
|
8
|
-
*
|
|
9
|
-
* - **Microphone**: the system default, then each microphone the browser lists. A
|
|
10
|
-
* desktop browser only: on a phone the recogniser picks the microphone itself,
|
|
11
|
-
* and a capture of ours would take it away (see `useVoiceInput`'s `deviceId`).
|
|
12
|
-
* - **Language**: the language the person speaks (the same setting as Settings ›
|
|
13
|
-
* Assistant): "Same as interface", then each language the assistant hears.
|
|
14
|
-
*/
|
|
15
|
-
/** "{microphone} · {language}": what dictation and voice chat use now. */
|
|
16
|
-
export declare function useMicSummary(): string;
|
|
17
2
|
export declare const AssistantMicMenu: FC<{
|
|
18
3
|
/** Start dictation. */
|
|
19
4
|
onDictate: () => void;
|