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