@burdenoff/fe-libs 2026.1114.14 → 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 +228 -234
- 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/ui/voice/AssistantVoiceSessionButton.d.ts +0 -5
- package/dist/shared/assistant/ui/voice/AssistantVoiceSessionButton.js +6 -6
- 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
|
@@ -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;
|
|
@@ -1,56 +1,42 @@
|
|
|
1
1
|
import { EscapeLayer as e } from "../../../components/EscapeLayer.js";
|
|
2
2
|
import { useAssistantTr as t } from "../../i18n.js";
|
|
3
3
|
import { useAssistantStore as n } from "../../store.js";
|
|
4
|
-
import { ASSISTANT_LANGUAGES as r
|
|
5
|
-
import { useDropdownEscape as
|
|
6
|
-
import { listMicrophones as
|
|
7
|
-
import { useCallback as
|
|
8
|
-
import { Check as
|
|
9
|
-
import { Fragment as
|
|
4
|
+
import { ASSISTANT_LANGUAGES as r } from "../../voice/languages.js";
|
|
5
|
+
import { useDropdownEscape as i } from "../useDropdownEscape.js";
|
|
6
|
+
import { listMicrophones as a, microphoneChoiceOffered as o } from "./microphones.js";
|
|
7
|
+
import { useCallback as s, useEffect as c, useRef as l, useState as u } from "react";
|
|
8
|
+
import { Check as d, ChevronDown as f, Mic as p, MicOff as m } from "lucide-react";
|
|
9
|
+
import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
|
|
10
10
|
// src/shared/assistant/ui/composer/AssistantMicMenu.tsx
|
|
11
|
-
|
|
12
|
-
let e = t(), r = n((e) => e.micDeviceId), a = n((e) => e.assistantLanguage), [s, c] = d(null);
|
|
13
|
-
l(() => {
|
|
14
|
-
if (!r) return;
|
|
15
|
-
let t = !0;
|
|
16
|
-
return o((t) => e("dictation.unnamedMicrophone", "Microphone {{n}}", { n: t })).then((e) => {
|
|
17
|
-
t && c(e.find((e) => e.deviceId === r)?.label ?? null);
|
|
18
|
-
}), () => {
|
|
19
|
-
t = !1;
|
|
20
|
-
};
|
|
21
|
-
}, [r, e]);
|
|
22
|
-
let u = r && s ? s : e("dictation.systemDefault", "System default"), f = i(a);
|
|
23
|
-
return `${u} · ${f ? f.label : e("voice.languageFollowApp", "Same as interface")}`;
|
|
24
|
-
}
|
|
25
|
-
var b = "flex min-h-11 w-full items-center justify-between gap-3 px-3 py-2 text-start text-sm sm:min-h-0 text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:bg-bg-sunken", x = ({ checked: e, label: t, onChoose: n, testId: r, lang: i }) => /* @__PURE__ */ v("button", {
|
|
11
|
+
var v = 10, y = 12, b = 340, x = 160, S = "flex min-h-11 w-full items-center justify-between gap-3 px-3 py-2 text-start text-sm sm:min-h-0 text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:bg-bg-sunken", C = ({ checked: e, label: t, onChoose: n, testId: r, lang: i }) => /* @__PURE__ */ _("button", {
|
|
26
12
|
type: "button",
|
|
27
13
|
role: "menuitemradio",
|
|
28
14
|
"aria-checked": e,
|
|
29
15
|
lang: i,
|
|
30
16
|
onClick: n,
|
|
31
|
-
className:
|
|
17
|
+
className: `${S} rounded-lg${e ? " bg-action-primary-bg/10" : ""}`,
|
|
32
18
|
"data-testid": r,
|
|
33
|
-
children: [/* @__PURE__ */
|
|
19
|
+
children: [/* @__PURE__ */ g("span", {
|
|
34
20
|
className: "truncate",
|
|
35
21
|
children: t
|
|
36
|
-
}), e ? /* @__PURE__ */
|
|
37
|
-
className: "size-4 shrink-0 text-
|
|
22
|
+
}), e ? /* @__PURE__ */ g(d, {
|
|
23
|
+
className: "size-4 shrink-0 text-action-primary-bg",
|
|
38
24
|
"aria-hidden": "true"
|
|
39
25
|
}) : null]
|
|
40
|
-
}),
|
|
26
|
+
}), w = ({ title: e, children: t }) => /* @__PURE__ */ _("div", {
|
|
41
27
|
role: "group",
|
|
42
28
|
"aria-label": e,
|
|
43
|
-
children: [/* @__PURE__ */
|
|
44
|
-
className: "px-3 pb-1 pt-2 text-
|
|
29
|
+
children: [/* @__PURE__ */ g("p", {
|
|
30
|
+
className: "px-3 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wider text-text-muted",
|
|
45
31
|
children: e
|
|
46
32
|
}), t]
|
|
47
33
|
});
|
|
48
|
-
function
|
|
49
|
-
let r = t(), [i,
|
|
50
|
-
return
|
|
34
|
+
function T(e, n) {
|
|
35
|
+
let r = t(), [i, o] = u([]);
|
|
36
|
+
return c(() => {
|
|
51
37
|
if (!e || !n) return;
|
|
52
|
-
let t = !0, i = () => void
|
|
53
|
-
t &&
|
|
38
|
+
let t = !0, i = () => void a((e) => r("dictation.unnamedMicrophone", "Microphone {{n}}", { n: e })).then((e) => {
|
|
39
|
+
t && o(e);
|
|
54
40
|
});
|
|
55
41
|
return i(), navigator.mediaDevices?.addEventListener?.("devicechange", i), () => {
|
|
56
42
|
t = !1, navigator.mediaDevices?.removeEventListener?.("devicechange", i);
|
|
@@ -61,38 +47,38 @@ function C(e, n) {
|
|
|
61
47
|
r
|
|
62
48
|
]), i;
|
|
63
49
|
}
|
|
64
|
-
var
|
|
65
|
-
let a = t(),
|
|
50
|
+
var E = ({ open: e, onChosen: i }) => {
|
|
51
|
+
let a = t(), s = n((e) => e.micDeviceId), c = n((e) => e.setMicDeviceId), l = n((e) => e.assistantLanguage), u = n((e) => e.setAssistantLanguage), d = o(), f = T(e, d), p = (e) => () => {
|
|
66
52
|
e(), i();
|
|
67
53
|
};
|
|
68
|
-
return /* @__PURE__ */
|
|
54
|
+
return /* @__PURE__ */ _(h, { children: [d ? /* @__PURE__ */ _(w, {
|
|
69
55
|
title: a("dictation.microphone", "Microphone"),
|
|
70
56
|
children: [
|
|
71
|
-
/* @__PURE__ */
|
|
72
|
-
checked:
|
|
57
|
+
/* @__PURE__ */ g(C, {
|
|
58
|
+
checked: s === null,
|
|
73
59
|
label: a("dictation.systemDefault", "System default"),
|
|
74
60
|
onChoose: p(() => c(null)),
|
|
75
61
|
testId: "assistant-mic-device-default"
|
|
76
62
|
}),
|
|
77
|
-
f.map((e) => /* @__PURE__ */
|
|
78
|
-
checked:
|
|
63
|
+
f.map((e) => /* @__PURE__ */ g(C, {
|
|
64
|
+
checked: s === e.deviceId,
|
|
79
65
|
label: e.label,
|
|
80
66
|
onChoose: p(() => c(e.deviceId)),
|
|
81
67
|
testId: "assistant-mic-device"
|
|
82
68
|
}, e.deviceId)),
|
|
83
|
-
/* @__PURE__ */
|
|
69
|
+
/* @__PURE__ */ g("div", {
|
|
84
70
|
className: "my-1 h-px bg-border-subtle",
|
|
85
71
|
"aria-hidden": "true"
|
|
86
72
|
})
|
|
87
73
|
]
|
|
88
|
-
}) : null, /* @__PURE__ */
|
|
74
|
+
}) : null, /* @__PURE__ */ _(w, {
|
|
89
75
|
title: a("dictation.language", "Language"),
|
|
90
|
-
children: [/* @__PURE__ */
|
|
76
|
+
children: [/* @__PURE__ */ g(C, {
|
|
91
77
|
checked: l === null,
|
|
92
78
|
label: a("voice.languageFollowApp", "Same as interface"),
|
|
93
79
|
onChoose: p(() => u(null)),
|
|
94
80
|
testId: "assistant-mic-language-default"
|
|
95
|
-
}), r.map((e) => /* @__PURE__ */
|
|
81
|
+
}), r.map((e) => /* @__PURE__ */ g(C, {
|
|
96
82
|
checked: l === e.code,
|
|
97
83
|
label: e.label,
|
|
98
84
|
lang: e.code,
|
|
@@ -100,9 +86,9 @@ var w = ({ open: e, onChosen: i }) => {
|
|
|
100
86
|
testId: "assistant-mic-language"
|
|
101
87
|
}, e.code))]
|
|
102
88
|
})] });
|
|
103
|
-
},
|
|
89
|
+
}, D = ({ onDictate: e, blocked: n, disabled: r }) => {
|
|
104
90
|
let i = t(), a = n ? i("dictation.blockedButton", "Dictate, microphone blocked") : i("composer.voiceStart", "Dictate a message");
|
|
105
|
-
return /* @__PURE__ */
|
|
91
|
+
return /* @__PURE__ */ g("button", {
|
|
106
92
|
type: "button",
|
|
107
93
|
onClick: e,
|
|
108
94
|
disabled: r,
|
|
@@ -111,66 +97,72 @@ var w = ({ open: e, onChosen: i }) => {
|
|
|
111
97
|
title: a,
|
|
112
98
|
"data-testid": "assistant-voice",
|
|
113
99
|
"data-state": n ? "blocked" : "idle",
|
|
114
|
-
children:
|
|
100
|
+
children: g(n ? m : p, {
|
|
115
101
|
className: "size-5",
|
|
116
102
|
"aria-hidden": "true"
|
|
117
103
|
})
|
|
118
104
|
});
|
|
119
|
-
},
|
|
120
|
-
let r = t(), [
|
|
121
|
-
|
|
105
|
+
}, O = ({ disabled: n }) => {
|
|
106
|
+
let r = t(), [a, o] = u(!1), d = l(null), p = l(null), m = s((e) => {
|
|
107
|
+
p.current = e;
|
|
108
|
+
let t = d.current;
|
|
109
|
+
if (!e || !t) return;
|
|
110
|
+
let n = t.getBoundingClientRect().top - v - y;
|
|
111
|
+
e.style.maxHeight = `${Math.max(x, Math.min(b, n))}px`;
|
|
112
|
+
}, []), S = s(() => o(!1), []), C = i(d, S), w = s(() => {
|
|
113
|
+
o(!1), d.current?.focus();
|
|
122
114
|
}, []);
|
|
123
|
-
|
|
124
|
-
if (!
|
|
115
|
+
c(() => {
|
|
116
|
+
if (!a) return;
|
|
125
117
|
let e = (e) => {
|
|
126
118
|
let t = e.target;
|
|
127
|
-
|
|
119
|
+
p.current?.contains(t) || d.current?.contains(t) || o(!1);
|
|
128
120
|
};
|
|
129
121
|
return window.addEventListener("mousedown", e), () => window.removeEventListener("mousedown", e);
|
|
130
|
-
}, [
|
|
131
|
-
let
|
|
132
|
-
return /* @__PURE__ */
|
|
133
|
-
/* @__PURE__ */
|
|
122
|
+
}, [a]);
|
|
123
|
+
let T = r("dictation.options", "Microphone and language options");
|
|
124
|
+
return /* @__PURE__ */ _(h, { children: [
|
|
125
|
+
/* @__PURE__ */ g("span", {
|
|
134
126
|
"aria-hidden": "true",
|
|
135
127
|
className: "h-5 w-px bg-border-default"
|
|
136
128
|
}),
|
|
137
|
-
/* @__PURE__ */
|
|
138
|
-
ref:
|
|
129
|
+
/* @__PURE__ */ g("button", {
|
|
130
|
+
ref: d,
|
|
139
131
|
type: "button",
|
|
140
132
|
onClick: () => o((e) => !e),
|
|
141
133
|
disabled: n,
|
|
142
134
|
className: "flex h-11 w-11 items-center justify-center rounded-e-full text-text-secondary transition-colors hover:bg-bg-sunken hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:cursor-not-allowed disabled:opacity-50 sm:h-10 sm:w-9",
|
|
143
|
-
"aria-label":
|
|
144
|
-
title:
|
|
135
|
+
"aria-label": T,
|
|
136
|
+
title: T,
|
|
145
137
|
"aria-haspopup": "menu",
|
|
146
|
-
"aria-expanded":
|
|
138
|
+
"aria-expanded": a,
|
|
147
139
|
"data-testid": "assistant-mic-options",
|
|
148
|
-
children: /* @__PURE__ */
|
|
140
|
+
children: /* @__PURE__ */ g(f, {
|
|
149
141
|
className: "size-4",
|
|
150
142
|
"aria-hidden": "true"
|
|
151
143
|
})
|
|
152
144
|
}),
|
|
153
|
-
|
|
154
|
-
...
|
|
155
|
-
children: /* @__PURE__ */
|
|
156
|
-
ref:
|
|
145
|
+
a ? /* @__PURE__ */ g(e, {
|
|
146
|
+
...C,
|
|
147
|
+
children: /* @__PURE__ */ g("div", {
|
|
148
|
+
ref: m,
|
|
157
149
|
role: "menu",
|
|
158
|
-
"aria-label":
|
|
159
|
-
className: "absolute bottom-full end-0 z-30 mb-2 max-
|
|
150
|
+
"aria-label": T,
|
|
151
|
+
className: "scrollbar-slim scrollbar-box absolute bottom-full end-0 z-30 mb-2.5 w-72 max-w-[calc(100vw-2rem)] overflow-y-auto overscroll-contain rounded-xl border border-border-default bg-bg-elevated p-1.5 shadow-lg",
|
|
160
152
|
"data-testid": "assistant-mic-menu",
|
|
161
|
-
children: /* @__PURE__ */
|
|
162
|
-
open:
|
|
163
|
-
onChosen:
|
|
153
|
+
children: /* @__PURE__ */ g(E, {
|
|
154
|
+
open: a,
|
|
155
|
+
onChosen: w
|
|
164
156
|
})
|
|
165
157
|
})
|
|
166
158
|
}) : null
|
|
167
159
|
] });
|
|
168
|
-
},
|
|
160
|
+
}, k = ({ onDictate: e, blocked: t, disabled: n }) => /* @__PURE__ */ _("div", {
|
|
169
161
|
className: "relative flex shrink-0 items-center rounded-full border border-border-default",
|
|
170
|
-
children: [/* @__PURE__ */
|
|
162
|
+
children: [/* @__PURE__ */ g(D, {
|
|
171
163
|
onDictate: e,
|
|
172
164
|
blocked: t,
|
|
173
165
|
disabled: n
|
|
174
|
-
}), t ? null : /* @__PURE__ */
|
|
166
|
+
}), t ? null : /* @__PURE__ */ g(O, { disabled: n })]
|
|
175
167
|
});
|
|
176
|
-
export {
|
|
168
|
+
export { k as AssistantMicMenu };
|
|
@@ -1,28 +1,28 @@
|
|
|
1
1
|
import { DropdownMenu as e, DropdownMenuContent as t, DropdownMenuRadioGroup as n, DropdownMenuRadioItem as r, DropdownMenuTrigger as i } from "../../../../ui/dropdown-menu.js";
|
|
2
|
-
import { focusWasDropped as
|
|
3
|
-
import { AUTO_WRITE_MODE as
|
|
4
|
-
import { useAssistantTr as
|
|
5
|
-
import { assistantModeShortDescriptionKey as
|
|
6
|
-
import { AUTO_MODE_OPTION_ID as
|
|
7
|
-
import { TAB_STOP_SELECTOR as
|
|
8
|
-
import { useCallback as
|
|
9
|
-
import { ChevronDown as
|
|
10
|
-
import { Fragment as
|
|
2
|
+
import { focusWasDropped as ee } from "../../../hooks/useReturnFocus.js";
|
|
3
|
+
import { AUTO_WRITE_MODE as a } from "../../autoRouting.js";
|
|
4
|
+
import { useAssistantTr as te } from "../../i18n.js";
|
|
5
|
+
import { assistantModeShortDescriptionKey as ne, translateProductCopy as o } from "../../productCopy.js";
|
|
6
|
+
import { AUTO_MODE_OPTION_ID as s, assistantModeMeta as c } from "./AssistantModeSelector.js";
|
|
7
|
+
import { TAB_STOP_SELECTOR as re, modeMenuItemKey as l, modeMenuOpenIndex as ie, modeMenuTriggerKey as ae, nextTabStop as oe } from "./modeMenuKeys.js";
|
|
8
|
+
import { useCallback as u, useId as d, useRef as f, useState as se } from "react";
|
|
9
|
+
import { Check as ce, ChevronDown as p, Wand2 as m } from "lucide-react";
|
|
10
|
+
import { Fragment as le, jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
11
11
|
// src/shared/assistant/ui/composer/AssistantModeMenu.tsx
|
|
12
|
-
function
|
|
13
|
-
return e(`mode.${t.id}`, t.label ||
|
|
12
|
+
function _(e, t) {
|
|
13
|
+
return e(`mode.${t.id}`, t.label || c(t).fallback);
|
|
14
14
|
}
|
|
15
|
-
var
|
|
16
|
-
function
|
|
15
|
+
var ue = "[data-radix-focus-guard],[data-radix-menu-content]";
|
|
16
|
+
function v(e) {
|
|
17
17
|
if (e.disabled === !0 || e.getAttribute("type") === "hidden" || e.closest("[inert],[hidden]")) return !0;
|
|
18
18
|
let t = e.checkVisibility;
|
|
19
19
|
return typeof t == "function" && !t.call(e);
|
|
20
20
|
}
|
|
21
|
-
var y = ({ mode: y, availableModes: b, onModeChange: x, auto: S, disabled: C = !1, disabledReason:
|
|
22
|
-
let
|
|
23
|
-
|
|
24
|
-
let
|
|
25
|
-
if (e ===
|
|
21
|
+
var y = ({ mode: y, availableModes: b, onModeChange: x, auto: S, disabled: C = !1, disabledReason: w = null, readOnly: T = !1, chip: E = !1 }) => {
|
|
22
|
+
let D = te(), O = d(), k = d(), [A, j] = se(!1);
|
|
23
|
+
A && C && j(!1);
|
|
24
|
+
let M = f(null), N = f([]), P = f("checked"), F = f(!1), I = S !== void 0, L = [...I ? [s] : [], ...b.map((e) => e.id)], R = S?.active ? s : y, z = L.indexOf(R), B = !!S?.active && y === "api-calls", V = b.find((e) => e.id === a), H = D("modeSelector.auto", "Auto"), de = D("modeSelector.autoHint", "Answers your questions, and proposes changes for you to approve"), fe = b.find((e) => e.id === y), U = B && V ? _(D, V) : null, W = S?.active ? U ? `${H} · ${U}` : H : _(D, fe ?? { id: y }), G = u((e) => {
|
|
25
|
+
if (e === R) {
|
|
26
26
|
let t = b.find((t) => t.id === e);
|
|
27
27
|
t?.writeCapable && x(t.id);
|
|
28
28
|
return;
|
|
@@ -37,159 +37,165 @@ var y = ({ mode: y, availableModes: b, onModeChange: x, auto: S, disabled: C = !
|
|
|
37
37
|
S,
|
|
38
38
|
b,
|
|
39
39
|
x,
|
|
40
|
-
|
|
41
|
-
]),
|
|
42
|
-
e && C || (e ?
|
|
43
|
-
}, [C]),
|
|
44
|
-
let t =
|
|
45
|
-
t !== null && (C ? e.preventDefault() : (
|
|
46
|
-
}, [C]),
|
|
40
|
+
R
|
|
41
|
+
]), pe = u((e) => {
|
|
42
|
+
e && C || (e ? F.current = !0 : P.current = "checked", j(e));
|
|
43
|
+
}, [C]), me = u((e) => {
|
|
44
|
+
let t = ae(e.key);
|
|
45
|
+
t !== null && (C ? e.preventDefault() : (P.current = t, e.key === "ArrowUp" && (e.preventDefault(), F.current = !0, j(!0))));
|
|
46
|
+
}, [C]), he = u((e) => {
|
|
47
47
|
C && e.preventDefault();
|
|
48
|
-
}, [C]), K =
|
|
49
|
-
let t =
|
|
50
|
-
if (
|
|
51
|
-
let n = t.ownerDocument, r = Array.from(n.querySelectorAll(
|
|
52
|
-
(r[i < 0 ? -1 :
|
|
48
|
+
}, [C]), K = u((e) => {
|
|
49
|
+
let t = M.current;
|
|
50
|
+
if (j(!1), !t) return;
|
|
51
|
+
let n = t.ownerDocument, r = Array.from(n.querySelectorAll(re)).filter((e) => !N.current.includes(e) && !e.closest(ue)), i = r.indexOf(t);
|
|
52
|
+
(r[i < 0 ? -1 : oe(r.map((e) => ({
|
|
53
53
|
tabIndex: e.tabIndex,
|
|
54
|
-
unreachable:
|
|
54
|
+
unreachable: v(e)
|
|
55
55
|
})), i, e)] ?? t).focus();
|
|
56
|
-
}, []), q =
|
|
56
|
+
}, []), q = u((e) => {
|
|
57
57
|
if (e.defaultPrevented) return;
|
|
58
|
-
let t =
|
|
58
|
+
let t = N.current.slice(0, L.length), n = t.findIndex((t) => t !== null && t === e.target), r = l(e.key, {
|
|
59
59
|
shiftKey: e.shiftKey,
|
|
60
60
|
index: n,
|
|
61
|
-
count:
|
|
61
|
+
count: L.length
|
|
62
62
|
});
|
|
63
63
|
r.kind === "move" ? (e.preventDefault(), t[r.index]?.focus()) : r.kind === "tab-out" && (e.preventDefault(), K(r.direction));
|
|
64
|
-
}, [
|
|
65
|
-
if (!
|
|
66
|
-
|
|
67
|
-
let t =
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
let t =
|
|
71
|
-
t && !
|
|
72
|
-
}, []),
|
|
73
|
-
|
|
64
|
+
}, [L.length, K]), ge = u((e) => {
|
|
65
|
+
if (!F.current || e.target !== e.currentTarget) return;
|
|
66
|
+
F.current = !1, e.preventDefault();
|
|
67
|
+
let t = ie(P.current, z, L.length);
|
|
68
|
+
P.current = "checked", N.current[t]?.focus();
|
|
69
|
+
}, [z, L.length]), _e = u((e) => {
|
|
70
|
+
let t = M.current;
|
|
71
|
+
t && !ee(t.ownerDocument) && e.preventDefault();
|
|
72
|
+
}, []), ve = u((e) => {
|
|
73
|
+
M.current?.focus(), G(e);
|
|
74
74
|
}, [G]);
|
|
75
|
-
if (
|
|
76
|
-
let
|
|
77
|
-
if (
|
|
75
|
+
if (L.length === 0) return null;
|
|
76
|
+
let J = D("modeMenu.staticLabel", "Mode: {{mode}}", { mode: W }), Y = S?.active ? m : c({ id: y }).icon;
|
|
77
|
+
if (L.length === 1 && !b.some((e) => e.writeCapable) || T) return E ? /* @__PURE__ */ g("span", {
|
|
78
78
|
className: "inline-flex h-8 min-w-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-border-default px-2.5 text-[13px] leading-tight text-text-secondary sm:h-[30px]",
|
|
79
|
-
title:
|
|
79
|
+
title: T ? D("modeMenu.readOnlyHint", "Change the mode in the full assistant") : J,
|
|
80
80
|
"data-testid": "assistant-mode-static",
|
|
81
81
|
"data-mode-id": y,
|
|
82
82
|
children: [
|
|
83
|
-
/* @__PURE__ */
|
|
83
|
+
/* @__PURE__ */ h(Y, {
|
|
84
84
|
className: "size-3.5 shrink-0",
|
|
85
85
|
"aria-hidden": "true"
|
|
86
86
|
}),
|
|
87
|
-
/* @__PURE__ */
|
|
87
|
+
/* @__PURE__ */ h("span", {
|
|
88
88
|
className: "truncate",
|
|
89
89
|
"aria-hidden": "true",
|
|
90
90
|
children: W
|
|
91
91
|
}),
|
|
92
|
-
/* @__PURE__ */
|
|
92
|
+
/* @__PURE__ */ h("span", {
|
|
93
93
|
className: "sr-only",
|
|
94
94
|
"data-testid": "assistant-mode-static-label",
|
|
95
|
-
children:
|
|
95
|
+
children: J
|
|
96
96
|
})
|
|
97
97
|
]
|
|
98
|
-
}) : /* @__PURE__ */
|
|
98
|
+
}) : /* @__PURE__ */ h("span", {
|
|
99
99
|
className: "inline-flex h-9 items-center px-3 text-sm text-text-secondary",
|
|
100
100
|
"data-testid": "assistant-mode-static",
|
|
101
101
|
"data-mode-id": y,
|
|
102
|
-
children:
|
|
102
|
+
children: D("modeMenu.staticLabel", "Mode: {{mode}}", { mode: W })
|
|
103
103
|
});
|
|
104
|
-
let
|
|
105
|
-
|
|
104
|
+
let X = w === "replying" ? D("modeMenu.disabledReplying", "Mode can't change while the assistant is replying. Stop the reply to change it.") : D("modeMenu.disabledBusy", "Mode can't change right now."), Z = "min-h-11 items-start gap-0 rounded-lg py-2 pe-3 data-[state=checked]:bg-action-primary-bg/10", Q = /* @__PURE__ */ h(ce, {
|
|
105
|
+
className: "size-4 text-action-primary-bg",
|
|
106
|
+
"aria-hidden": "true"
|
|
107
|
+
}), $ = (e) => (t) => {
|
|
108
|
+
N.current[e] = t;
|
|
106
109
|
};
|
|
107
|
-
return /* @__PURE__ */
|
|
108
|
-
open:
|
|
109
|
-
onOpenChange:
|
|
110
|
+
return /* @__PURE__ */ g(le, { children: [/* @__PURE__ */ g(e, {
|
|
111
|
+
open: A,
|
|
112
|
+
onOpenChange: pe,
|
|
110
113
|
modal: !1,
|
|
111
|
-
children: [/* @__PURE__ */
|
|
114
|
+
children: [/* @__PURE__ */ h(i, {
|
|
112
115
|
asChild: !0,
|
|
113
|
-
children: /* @__PURE__ */
|
|
114
|
-
ref:
|
|
116
|
+
children: /* @__PURE__ */ g("button", {
|
|
117
|
+
ref: M,
|
|
115
118
|
type: "button",
|
|
116
|
-
"aria-label":
|
|
119
|
+
"aria-label": E ? J : D("modeMenu.trigger", "Assistant mode: {{mode}}", { mode: W }),
|
|
117
120
|
"aria-disabled": C || void 0,
|
|
118
|
-
"aria-describedby": C ?
|
|
119
|
-
title: C ?
|
|
120
|
-
onKeyDown:
|
|
121
|
-
onPointerDown:
|
|
122
|
-
className: `${
|
|
121
|
+
"aria-describedby": C ? O : void 0,
|
|
122
|
+
title: C ? X : void 0,
|
|
123
|
+
onKeyDown: me,
|
|
124
|
+
onPointerDown: he,
|
|
125
|
+
className: `${E ? "inline-flex h-11 min-w-0 items-center gap-1.5 whitespace-nowrap rounded-full border border-border-default px-2.5 text-[13px] font-medium leading-tight text-text-primary transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] sm:h-10" : "inline-flex h-9 min-w-0 items-center gap-2 rounded-full ps-3 pe-2 text-sm font-medium text-text-primary transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)]"} ${C ? "cursor-not-allowed opacity-50" : "hover:bg-bg-surface"}`,
|
|
123
126
|
"data-testid": "assistant-mode-selector",
|
|
124
|
-
"data-selected-mode-id":
|
|
127
|
+
"data-selected-mode-id": R,
|
|
125
128
|
children: [
|
|
126
|
-
/* @__PURE__ */
|
|
129
|
+
/* @__PURE__ */ h(Y, {
|
|
127
130
|
className: "size-4 shrink-0 text-text-secondary",
|
|
128
131
|
"aria-hidden": "true"
|
|
129
132
|
}),
|
|
130
|
-
/* @__PURE__ */
|
|
133
|
+
/* @__PURE__ */ h("span", {
|
|
131
134
|
className: "truncate",
|
|
132
135
|
children: W
|
|
133
136
|
}),
|
|
134
|
-
/* @__PURE__ */
|
|
137
|
+
/* @__PURE__ */ h(p, {
|
|
135
138
|
className: "size-4 shrink-0 text-text-muted",
|
|
136
139
|
"aria-hidden": "true"
|
|
137
140
|
})
|
|
138
141
|
]
|
|
139
142
|
})
|
|
140
|
-
}), /* @__PURE__ */
|
|
143
|
+
}), /* @__PURE__ */ h(t, {
|
|
141
144
|
side: "top",
|
|
142
145
|
align: "start",
|
|
143
|
-
sideOffset:
|
|
146
|
+
sideOffset: 10,
|
|
144
147
|
collisionPadding: 8,
|
|
145
|
-
|
|
146
|
-
|
|
148
|
+
avoidCollisions: !1,
|
|
149
|
+
onFocus: ge,
|
|
150
|
+
onCloseAutoFocus: _e,
|
|
147
151
|
onKeyDown: q,
|
|
148
|
-
className: "w-72 max-w-[calc(100vw-2rem)] max-h-[var(--radix-dropdown-menu-content-available-height)] overflow-y-auto",
|
|
152
|
+
className: "scrollbar-slim scrollbar-box w-72 max-w-[calc(100vw-2rem)] max-h-[min(22.5rem,var(--radix-dropdown-menu-content-available-height))] overflow-y-auto overscroll-contain",
|
|
149
153
|
"data-testid": "assistant-mode-menu",
|
|
150
|
-
children: /* @__PURE__ */
|
|
151
|
-
value:
|
|
152
|
-
onValueChange:
|
|
153
|
-
children: [
|
|
154
|
+
children: /* @__PURE__ */ g(n, {
|
|
155
|
+
value: R,
|
|
156
|
+
onValueChange: ve,
|
|
157
|
+
children: [I ? /* @__PURE__ */ h(r, {
|
|
154
158
|
ref: $(0),
|
|
155
|
-
value:
|
|
159
|
+
value: s,
|
|
156
160
|
onKeyDown: q,
|
|
157
|
-
"aria-labelledby": `${
|
|
158
|
-
"aria-describedby": `${
|
|
159
|
-
className:
|
|
161
|
+
"aria-labelledby": `${k}-label-0`,
|
|
162
|
+
"aria-describedby": `${k}-description-0`,
|
|
163
|
+
className: Z,
|
|
164
|
+
indicator: Q,
|
|
160
165
|
"data-testid": "assistant-mode-auto",
|
|
161
|
-
"data-auto-routed":
|
|
162
|
-
children: /* @__PURE__ */
|
|
166
|
+
"data-auto-routed": B ? a : void 0,
|
|
167
|
+
children: /* @__PURE__ */ g("span", {
|
|
163
168
|
className: "flex min-w-0 flex-col",
|
|
164
|
-
children: [/* @__PURE__ */
|
|
165
|
-
id: `${
|
|
169
|
+
children: [/* @__PURE__ */ h("span", {
|
|
170
|
+
id: `${k}-label-0`,
|
|
166
171
|
className: "font-medium",
|
|
167
|
-
children:
|
|
168
|
-
}), /* @__PURE__ */
|
|
169
|
-
id: `${
|
|
172
|
+
children: H
|
|
173
|
+
}), /* @__PURE__ */ h("span", {
|
|
174
|
+
id: `${k}-description-0`,
|
|
170
175
|
className: "text-xs text-text-secondary",
|
|
171
176
|
"data-testid": "assistant-mode-description",
|
|
172
|
-
children:
|
|
177
|
+
children: de
|
|
173
178
|
})]
|
|
174
179
|
})
|
|
175
180
|
}) : null, b.map((e, t) => {
|
|
176
|
-
let n = t + +!!
|
|
177
|
-
return /* @__PURE__ */
|
|
181
|
+
let n = t + +!!I, i = e.shortDescription?.trim() ? o(D, ne(e.id), e.shortDescription) : null;
|
|
182
|
+
return /* @__PURE__ */ h(r, {
|
|
178
183
|
ref: $(n),
|
|
179
184
|
value: e.id,
|
|
180
185
|
onKeyDown: q,
|
|
181
|
-
"aria-labelledby": `${
|
|
182
|
-
"aria-describedby": i ? `${
|
|
183
|
-
className:
|
|
186
|
+
"aria-labelledby": `${k}-label-${n}`,
|
|
187
|
+
"aria-describedby": i ? `${k}-description-${n}` : void 0,
|
|
188
|
+
className: Z,
|
|
189
|
+
indicator: Q,
|
|
184
190
|
"data-testid": `assistant-mode-option-${e.id}`,
|
|
185
|
-
children: /* @__PURE__ */
|
|
191
|
+
children: /* @__PURE__ */ g("span", {
|
|
186
192
|
className: "flex min-w-0 flex-col",
|
|
187
|
-
children: [/* @__PURE__ */
|
|
188
|
-
id: `${
|
|
193
|
+
children: [/* @__PURE__ */ h("span", {
|
|
194
|
+
id: `${k}-label-${n}`,
|
|
189
195
|
className: "font-medium",
|
|
190
|
-
children:
|
|
191
|
-
}), i ? /* @__PURE__ */
|
|
192
|
-
id: `${
|
|
196
|
+
children: _(D, e)
|
|
197
|
+
}), i ? /* @__PURE__ */ h("span", {
|
|
198
|
+
id: `${k}-description-${n}`,
|
|
193
199
|
className: "text-xs text-text-secondary",
|
|
194
200
|
"data-testid": "assistant-mode-description",
|
|
195
201
|
children: i
|
|
@@ -199,11 +205,11 @@ var y = ({ mode: y, availableModes: b, onModeChange: x, auto: S, disabled: C = !
|
|
|
199
205
|
})]
|
|
200
206
|
})
|
|
201
207
|
})]
|
|
202
|
-
}), C ? /* @__PURE__ */
|
|
203
|
-
id:
|
|
208
|
+
}), C ? /* @__PURE__ */ h("span", {
|
|
209
|
+
id: O,
|
|
204
210
|
className: "sr-only",
|
|
205
211
|
"data-testid": "assistant-mode-disabled-reason",
|
|
206
|
-
children:
|
|
212
|
+
children: X
|
|
207
213
|
}) : null] });
|
|
208
214
|
};
|
|
209
|
-
export { y as AssistantModeMenu,
|
|
215
|
+
export { y as AssistantModeMenu, _ as assistantModeOptionName };
|
|
@@ -23,9 +23,4 @@ export declare const AssistantVoiceSessionButton: FC<{
|
|
|
23
23
|
compact?: boolean;
|
|
24
24
|
/** Keep the compact opener mounted for focus return while its session is live. */
|
|
25
25
|
invisible?: boolean;
|
|
26
|
-
/**
|
|
27
|
-
* ★ BOFF-13461 (page): a secondary circle beside Send, the wave in the
|
|
28
|
-
* assistant's blue, as the operator's design draws it.
|
|
29
|
-
*/
|
|
30
|
-
secondary?: boolean;
|
|
31
26
|
}>;
|
|
@@ -2,17 +2,17 @@ import { useAssistantTr as e } from "../../i18n.js";
|
|
|
2
2
|
import { AudioLines as t } from "lucide-react";
|
|
3
3
|
import { jsx as n } from "react/jsx-runtime";
|
|
4
4
|
// src/shared/assistant/ui/voice/AssistantVoiceSessionButton.tsx
|
|
5
|
-
var r = ({ onStart: r, disabled: i = !1, compact: a = !1, invisible: o = !1
|
|
6
|
-
let
|
|
5
|
+
var r = ({ onStart: r, disabled: i = !1, compact: a = !1, invisible: o = !1 }) => {
|
|
6
|
+
let s = e();
|
|
7
7
|
return /* @__PURE__ */ n("button", {
|
|
8
8
|
type: "button",
|
|
9
9
|
onClick: r,
|
|
10
10
|
disabled: i,
|
|
11
|
-
className:
|
|
12
|
-
"aria-label":
|
|
13
|
-
title:
|
|
11
|
+
className: a ? `flex size-11 shrink-0 items-center justify-center rounded-full bg-action-primary-bg text-action-primary-text transition-colors hover:bg-action-primary-bg-hover focus:outline-none focus-visible:ring-2 focus-visible:ring-[var(--color-focus-ring)] disabled:cursor-not-allowed disabled:opacity-50 sm:size-10${o ? " invisible" : ""}` : "flex size-9 flex-shrink-0 items-center justify-center rounded-full bg-bg-elevated text-text-secondary shadow-sm transition-all hover:scale-105 hover:bg-bg-raised hover:text-text-primary focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong disabled:cursor-not-allowed disabled:opacity-50 disabled:hover:scale-100",
|
|
12
|
+
"aria-label": s("voiceSession.start", "Start a voice conversation"),
|
|
13
|
+
title: s("voiceSession.start", "Start a voice conversation"),
|
|
14
14
|
"data-testid": "assistant-voice-session-start",
|
|
15
|
-
children: /* @__PURE__ */ n(t, { className: a
|
|
15
|
+
children: /* @__PURE__ */ n(t, { className: a ? "size-5" : "size-4" })
|
|
16
16
|
});
|
|
17
17
|
};
|
|
18
18
|
export { r as AssistantVoiceSessionButton };
|