@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.
@@ -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 { 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";
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 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", {
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: `${S} rounded-lg${e ? " bg-action-primary-bg/10" : ""}`,
18
+ className: `${C} rounded-lg${e ? " bg-action-primary-bg/10" : ""}`,
18
19
  "data-testid": r,
19
- children: [/* @__PURE__ */ g("span", {
20
+ children: [/* @__PURE__ */ _("span", {
20
21
  className: "truncate",
21
22
  children: t
22
- }), e ? /* @__PURE__ */ g(d, {
23
+ }), e ? /* @__PURE__ */ _(f, {
23
24
  className: "size-4 shrink-0 text-action-primary-bg",
24
25
  "aria-hidden": "true"
25
26
  }) : null]
26
- }), w = ({ title: e, children: t }) => /* @__PURE__ */ _("div", {
27
+ }), T = ({ title: e, children: t }) => /* @__PURE__ */ v("div", {
27
28
  role: "group",
28
29
  "aria-label": e,
29
- children: [/* @__PURE__ */ g("p", {
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 T(e, n) {
35
- let r = t(), [i, o] = u([]);
36
- return c(() => {
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 a((e) => r("dictation.unnamedMicrophone", "Microphone {{n}}", { n: e })).then((e) => {
39
- t && o(e);
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 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) => () => {
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__ */ _(h, { children: [d ? /* @__PURE__ */ _(w, {
55
+ return /* @__PURE__ */ v(g, { children: [d ? /* @__PURE__ */ v(T, {
55
56
  title: a("dictation.microphone", "Microphone"),
56
57
  children: [
57
- /* @__PURE__ */ g(C, {
58
- checked: s === null,
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__ */ g(C, {
64
- checked: s === e.deviceId,
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__ */ g("div", {
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__ */ _(w, {
75
+ }) : null, /* @__PURE__ */ v(T, {
75
76
  title: a("dictation.language", "Language"),
76
- children: [/* @__PURE__ */ g(C, {
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__ */ g(C, {
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
- }, D = ({ onDictate: e, blocked: n, disabled: r }) => {
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__ */ g("button", {
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: g(n ? m : p, {
101
+ children: _(n ? h : m, {
101
102
  className: "size-5",
102
103
  "aria-hidden": "true"
103
104
  })
104
105
  });
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;
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.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();
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
- c(() => {
116
- if (!a) return;
116
+ l(() => {
117
+ if (!o) return;
117
118
  let e = (e) => {
118
119
  let t = e.target;
119
- p.current?.contains(t) || d.current?.contains(t) || o(!1);
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
- }, [a]);
123
- let T = r("dictation.options", "Microphone and language options");
124
- return /* @__PURE__ */ _(h, { children: [
125
- /* @__PURE__ */ g("span", {
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__ */ g("button", {
130
- ref: d,
130
+ /* @__PURE__ */ _("button", {
131
+ ref: f,
131
132
  type: "button",
132
- onClick: () => o((e) => !e),
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": T,
136
- title: T,
136
+ "aria-label": E,
137
+ title: E,
137
138
  "aria-haspopup": "menu",
138
- "aria-expanded": a,
139
+ "aria-expanded": o,
139
140
  "data-testid": "assistant-mic-options",
140
- children: /* @__PURE__ */ g(f, {
141
+ children: /* @__PURE__ */ _(p, {
141
142
  className: "size-4",
142
143
  "aria-hidden": "true"
143
144
  })
144
145
  }),
145
- a ? /* @__PURE__ */ g(e, {
146
- ...C,
147
- children: /* @__PURE__ */ g("div", {
148
- ref: m,
146
+ o ? /* @__PURE__ */ _(e, {
147
+ ...w,
148
+ children: /* @__PURE__ */ _("div", {
149
+ ref: h,
149
150
  role: "menu",
150
- "aria-label": T,
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__ */ g(E, {
154
- open: a,
155
- onChosen: w
154
+ children: /* @__PURE__ */ _(D, {
155
+ open: o,
156
+ onChosen: T
156
157
  })
157
158
  })
158
159
  }) : null
159
160
  ] });
160
- }, k = ({ onDictate: e, blocked: t, disabled: n }) => /* @__PURE__ */ _("div", {
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__ */ g(D, {
163
+ children: [/* @__PURE__ */ _(O, {
163
164
  onDictate: e,
164
165
  blocked: t,
165
166
  disabled: n
166
- }), t ? null : /* @__PURE__ */ g(O, { disabled: n })]
167
+ }), t ? null : /* @__PURE__ */ _(k, { disabled: n })]
167
168
  });
168
- export { k as AssistantMicMenu };
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 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";
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 _(e, t) {
13
- return e(`mode.${t.id}`, t.label || c(t).fallback);
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 v(e) {
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: 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) {
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
- R
41
- ]), pe = u((e) => {
42
- e && C || (e ? F.current = !0 : P.current = "checked", j(e));
43
- }, [C]), me = u((e) => {
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() : (P.current = t, e.key === "ArrowUp" && (e.preventDefault(), F.current = !0, j(!0))));
46
- }, [C]), he = u((e) => {
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]), 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) => ({
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: v(e)
55
+ unreachable: de(e)
55
56
  })), i, e)] ?? t).focus();
56
- }, []), q = u((e) => {
57
+ }, []), K = f((e) => {
57
58
  if (e.defaultPrevented) return;
58
- let t = N.current.slice(0, L.length), n = t.findIndex((t) => t !== null && t === e.target), r = l(e.key, {
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: L.length
62
+ count: I.length
62
63
  });
63
- r.kind === "move" ? (e.preventDefault(), t[r.index]?.focus()) : r.kind === "tab-out" && (e.preventDefault(), K(r.direction));
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;
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
- }, []), ve = u((e) => {
73
- M.current?.focus(), G(e);
74
- }, [G]);
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", {
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: T ? D("modeMenu.readOnlyHint", "Change the mode in the full assistant") : J,
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__ */ h(Y, {
84
+ /* @__PURE__ */ g(Y, {
84
85
  className: "size-3.5 shrink-0",
85
86
  "aria-hidden": "true"
86
87
  }),
87
- /* @__PURE__ */ h("span", {
88
+ /* @__PURE__ */ g("span", {
88
89
  className: "truncate",
89
90
  "aria-hidden": "true",
90
- children: W
91
+ children: U
91
92
  }),
92
- /* @__PURE__ */ h("span", {
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__ */ h("span", {
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: D("modeMenu.staticLabel", "Mode: {{mode}}", { mode: W })
103
+ children: E("modeMenu.staticLabel", "Mode: {{mode}}", { mode: U })
103
104
  });
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
+ 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
- N.current[e] = t;
109
+ M.current[e] = t;
109
110
  };
110
- return /* @__PURE__ */ g(le, { children: [/* @__PURE__ */ g(e, {
111
- open: A,
112
- onOpenChange: pe,
111
+ return /* @__PURE__ */ _(le, { children: [/* @__PURE__ */ _(e, {
112
+ open: k,
113
+ onOpenChange: _e,
113
114
  modal: !1,
114
- children: [/* @__PURE__ */ h(i, {
115
+ children: [/* @__PURE__ */ g(i, {
115
116
  asChild: !0,
116
- children: /* @__PURE__ */ g("button", {
117
- ref: M,
117
+ children: /* @__PURE__ */ _("button", {
118
+ ref: j,
118
119
  type: "button",
119
- "aria-label": E ? J : D("modeMenu.trigger", "Assistant mode: {{mode}}", { mode: W }),
120
+ "aria-label": T ? J : E("modeMenu.trigger", "Assistant mode: {{mode}}", { mode: U }),
120
121
  "aria-disabled": C || void 0,
121
- "aria-describedby": C ? O : void 0,
122
+ "aria-describedby": C ? D : void 0,
122
123
  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"}`,
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": R,
128
+ "data-selected-mode-id": L,
128
129
  children: [
129
- /* @__PURE__ */ h(Y, {
130
+ /* @__PURE__ */ g(Y, {
130
131
  className: "size-4 shrink-0 text-text-secondary",
131
132
  "aria-hidden": "true"
132
133
  }),
133
- /* @__PURE__ */ h("span", {
134
+ /* @__PURE__ */ g("span", {
134
135
  className: "truncate",
135
- children: W
136
+ children: U
136
137
  }),
137
- /* @__PURE__ */ h(p, {
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__ */ h(t, {
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: ge,
150
- onCloseAutoFocus: _e,
151
- onKeyDown: q,
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__ */ g(n, {
155
- value: R,
156
- onValueChange: ve,
157
- children: [I ? /* @__PURE__ */ h(r, {
156
+ children: /* @__PURE__ */ _(n, {
157
+ value: L,
158
+ onValueChange: xe,
159
+ children: [F ? /* @__PURE__ */ g(r, {
158
160
  ref: $(0),
159
- value: s,
160
- onKeyDown: q,
161
- "aria-labelledby": `${k}-label-0`,
162
- "aria-describedby": `${k}-description-0`,
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": B ? a : void 0,
167
- children: /* @__PURE__ */ g("span", {
168
+ "data-auto-routed": z ? a : void 0,
169
+ children: /* @__PURE__ */ _("span", {
168
170
  className: "flex min-w-0 flex-col",
169
- children: [/* @__PURE__ */ h("span", {
170
- id: `${k}-label-0`,
171
+ children: [/* @__PURE__ */ g("span", {
172
+ id: `${O}-label-0`,
171
173
  className: "font-medium",
172
- children: H
173
- }), /* @__PURE__ */ h("span", {
174
- id: `${k}-description-0`,
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: de
179
+ children: he
178
180
  })]
179
181
  })
180
182
  }) : null, b.map((e, t) => {
181
- let n = t + +!!I, i = e.shortDescription?.trim() ? o(D, ne(e.id), e.shortDescription) : null;
182
- return /* @__PURE__ */ h(r, {
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: q,
186
- "aria-labelledby": `${k}-label-${n}`,
187
- "aria-describedby": i ? `${k}-description-${n}` : void 0,
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__ */ g("span", {
193
+ children: /* @__PURE__ */ _("span", {
192
194
  className: "flex min-w-0 flex-col",
193
- children: [/* @__PURE__ */ h("span", {
194
- id: `${k}-label-${n}`,
195
+ children: [/* @__PURE__ */ g("span", {
196
+ id: `${O}-label-${n}`,
195
197
  className: "font-medium",
196
- children: _(D, e)
197
- }), i ? /* @__PURE__ */ h("span", {
198
- id: `${k}-description-${n}`,
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__ */ h("span", {
209
- id: O,
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, _ as assistantModeOptionName };
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 };