@burdenoff/fe-libs 2026.1114.15 → 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/AssistantComposer.js +163 -163
- package/dist/shared/assistant/ui/composer/AssistantMicMenu.d.ts +0 -15
- package/dist/shared/assistant/ui/composer/AssistantMicMenu.js +48 -55
- package/dist/shared/assistant/ui/composer/AssistantModeMenu.js +68 -60
- 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 +186 -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,51 +1,38 @@
|
|
|
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
|
|
4
|
+
import { ASSISTANT_LANGUAGES as r } from "../../voice/languages.js";
|
|
5
|
+
import { useDropdownEscape as i } from "../useDropdownEscape.js";
|
|
6
|
+
import { roomAbove as a } from "./menuRoom.js";
|
|
6
7
|
import { listMicrophones as o, microphoneChoiceOffered as s } from "./microphones.js";
|
|
7
8
|
import { useCallback as c, useEffect as l, useRef as u, useState as d } from "react";
|
|
8
9
|
import { Check as f, ChevronDown as p, Mic as m, MicOff as h } from "lucide-react";
|
|
9
10
|
import { Fragment as g, jsx as _, jsxs as v } from "react/jsx-runtime";
|
|
10
11
|
// 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", {
|
|
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", {
|
|
26
13
|
type: "button",
|
|
27
14
|
role: "menuitemradio",
|
|
28
15
|
"aria-checked": e,
|
|
29
16
|
lang: i,
|
|
30
17
|
onClick: n,
|
|
31
|
-
className:
|
|
18
|
+
className: `${C} rounded-lg${e ? " bg-action-primary-bg/10" : ""}`,
|
|
32
19
|
"data-testid": r,
|
|
33
20
|
children: [/* @__PURE__ */ _("span", {
|
|
34
21
|
className: "truncate",
|
|
35
22
|
children: t
|
|
36
23
|
}), e ? /* @__PURE__ */ _(f, {
|
|
37
|
-
className: "size-4 shrink-0 text-
|
|
24
|
+
className: "size-4 shrink-0 text-action-primary-bg",
|
|
38
25
|
"aria-hidden": "true"
|
|
39
26
|
}) : null]
|
|
40
|
-
}),
|
|
27
|
+
}), T = ({ title: e, children: t }) => /* @__PURE__ */ v("div", {
|
|
41
28
|
role: "group",
|
|
42
29
|
"aria-label": e,
|
|
43
30
|
children: [/* @__PURE__ */ _("p", {
|
|
44
|
-
className: "px-3 pb-1 pt-2 text-
|
|
31
|
+
className: "px-3 pb-1 pt-2 text-[11px] font-semibold uppercase tracking-wider text-text-muted",
|
|
45
32
|
children: e
|
|
46
33
|
}), t]
|
|
47
34
|
});
|
|
48
|
-
function
|
|
35
|
+
function E(e, n) {
|
|
49
36
|
let r = t(), [i, a] = d([]);
|
|
50
37
|
return l(() => {
|
|
51
38
|
if (!e || !n) return;
|
|
@@ -61,20 +48,20 @@ function C(e, n) {
|
|
|
61
48
|
r
|
|
62
49
|
]), i;
|
|
63
50
|
}
|
|
64
|
-
var
|
|
65
|
-
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 =
|
|
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) => () => {
|
|
66
53
|
e(), i();
|
|
67
54
|
};
|
|
68
|
-
return /* @__PURE__ */ v(g, { children: [d ? /* @__PURE__ */ v(
|
|
55
|
+
return /* @__PURE__ */ v(g, { children: [d ? /* @__PURE__ */ v(T, {
|
|
69
56
|
title: a("dictation.microphone", "Microphone"),
|
|
70
57
|
children: [
|
|
71
|
-
/* @__PURE__ */ _(
|
|
58
|
+
/* @__PURE__ */ _(w, {
|
|
72
59
|
checked: o === null,
|
|
73
60
|
label: a("dictation.systemDefault", "System default"),
|
|
74
61
|
onChoose: p(() => c(null)),
|
|
75
62
|
testId: "assistant-mic-device-default"
|
|
76
63
|
}),
|
|
77
|
-
f.map((e) => /* @__PURE__ */ _(
|
|
64
|
+
f.map((e) => /* @__PURE__ */ _(w, {
|
|
78
65
|
checked: o === e.deviceId,
|
|
79
66
|
label: e.label,
|
|
80
67
|
onChoose: p(() => c(e.deviceId)),
|
|
@@ -85,14 +72,14 @@ var w = ({ open: e, onChosen: i }) => {
|
|
|
85
72
|
"aria-hidden": "true"
|
|
86
73
|
})
|
|
87
74
|
]
|
|
88
|
-
}) : null, /* @__PURE__ */ v(
|
|
75
|
+
}) : null, /* @__PURE__ */ v(T, {
|
|
89
76
|
title: a("dictation.language", "Language"),
|
|
90
|
-
children: [/* @__PURE__ */ _(
|
|
77
|
+
children: [/* @__PURE__ */ _(w, {
|
|
91
78
|
checked: l === null,
|
|
92
79
|
label: a("voice.languageFollowApp", "Same as interface"),
|
|
93
80
|
onChoose: p(() => u(null)),
|
|
94
81
|
testId: "assistant-mic-language-default"
|
|
95
|
-
}), r.map((e) => /* @__PURE__ */ _(
|
|
82
|
+
}), r.map((e) => /* @__PURE__ */ _(w, {
|
|
96
83
|
checked: l === e.code,
|
|
97
84
|
label: e.label,
|
|
98
85
|
lang: e.code,
|
|
@@ -100,7 +87,7 @@ var w = ({ open: e, onChosen: i }) => {
|
|
|
100
87
|
testId: "assistant-mic-language"
|
|
101
88
|
}, e.code))]
|
|
102
89
|
})] });
|
|
103
|
-
},
|
|
90
|
+
}, O = ({ onDictate: e, blocked: n, disabled: r }) => {
|
|
104
91
|
let i = t(), a = n ? i("dictation.blockedButton", "Dictate, microphone blocked") : i("composer.voiceStart", "Dictate a message");
|
|
105
92
|
return /* @__PURE__ */ _("button", {
|
|
106
93
|
type: "button",
|
|
@@ -116,61 +103,67 @@ var w = ({ open: e, onChosen: i }) => {
|
|
|
116
103
|
"aria-hidden": "true"
|
|
117
104
|
})
|
|
118
105
|
});
|
|
119
|
-
},
|
|
120
|
-
let r = t(), [
|
|
121
|
-
|
|
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;
|
|
110
|
+
if (!e || !t) return;
|
|
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();
|
|
122
115
|
}, []);
|
|
123
116
|
l(() => {
|
|
124
|
-
if (!
|
|
117
|
+
if (!o) return;
|
|
125
118
|
let e = (e) => {
|
|
126
119
|
let t = e.target;
|
|
127
|
-
|
|
120
|
+
m.current?.contains(t) || f.current?.contains(t) || s(!1);
|
|
128
121
|
};
|
|
129
122
|
return window.addEventListener("mousedown", e), () => window.removeEventListener("mousedown", e);
|
|
130
|
-
}, [
|
|
131
|
-
let
|
|
123
|
+
}, [o]);
|
|
124
|
+
let E = r("dictation.options", "Microphone and language options");
|
|
132
125
|
return /* @__PURE__ */ v(g, { children: [
|
|
133
126
|
/* @__PURE__ */ _("span", {
|
|
134
127
|
"aria-hidden": "true",
|
|
135
128
|
className: "h-5 w-px bg-border-default"
|
|
136
129
|
}),
|
|
137
130
|
/* @__PURE__ */ _("button", {
|
|
138
|
-
ref:
|
|
131
|
+
ref: f,
|
|
139
132
|
type: "button",
|
|
140
|
-
onClick: () =>
|
|
133
|
+
onClick: () => s((e) => !e),
|
|
141
134
|
disabled: n,
|
|
142
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",
|
|
143
|
-
"aria-label":
|
|
144
|
-
title:
|
|
136
|
+
"aria-label": E,
|
|
137
|
+
title: E,
|
|
145
138
|
"aria-haspopup": "menu",
|
|
146
|
-
"aria-expanded":
|
|
139
|
+
"aria-expanded": o,
|
|
147
140
|
"data-testid": "assistant-mic-options",
|
|
148
141
|
children: /* @__PURE__ */ _(p, {
|
|
149
142
|
className: "size-4",
|
|
150
143
|
"aria-hidden": "true"
|
|
151
144
|
})
|
|
152
145
|
}),
|
|
153
|
-
|
|
154
|
-
...
|
|
146
|
+
o ? /* @__PURE__ */ _(e, {
|
|
147
|
+
...w,
|
|
155
148
|
children: /* @__PURE__ */ _("div", {
|
|
156
|
-
ref:
|
|
149
|
+
ref: h,
|
|
157
150
|
role: "menu",
|
|
158
|
-
"aria-label":
|
|
159
|
-
className: "absolute bottom-full end-0 z-30 mb-2 max-
|
|
151
|
+
"aria-label": E,
|
|
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",
|
|
160
153
|
"data-testid": "assistant-mic-menu",
|
|
161
|
-
children: /* @__PURE__ */ _(
|
|
162
|
-
open:
|
|
163
|
-
onChosen:
|
|
154
|
+
children: /* @__PURE__ */ _(D, {
|
|
155
|
+
open: o,
|
|
156
|
+
onChosen: T
|
|
164
157
|
})
|
|
165
158
|
})
|
|
166
159
|
}) : null
|
|
167
160
|
] });
|
|
168
|
-
},
|
|
161
|
+
}, A = ({ onDictate: e, blocked: t, disabled: n }) => /* @__PURE__ */ v("div", {
|
|
169
162
|
className: "relative flex shrink-0 items-center rounded-full border border-border-default",
|
|
170
|
-
children: [/* @__PURE__ */ _(
|
|
163
|
+
children: [/* @__PURE__ */ _(O, {
|
|
171
164
|
onDictate: e,
|
|
172
165
|
blocked: t,
|
|
173
166
|
disabled: n
|
|
174
|
-
}), t ? null : /* @__PURE__ */ _(
|
|
167
|
+
}), t ? null : /* @__PURE__ */ _(k, { disabled: n })]
|
|
175
168
|
});
|
|
176
|
-
export {
|
|
169
|
+
export { A as AssistantMicMenu };
|
|
@@ -1,27 +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 {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { focusWasDropped as ee } from "../../../hooks/useReturnFocus.js";
|
|
3
|
+
import { clippingAncestor as te } from "./menuRoom.js";
|
|
4
|
+
import { AUTO_WRITE_MODE as a } from "../../autoRouting.js";
|
|
5
|
+
import { useAssistantTr as o } from "../../i18n.js";
|
|
6
|
+
import { assistantModeShortDescriptionKey as s, translateProductCopy as ne } from "../../productCopy.js";
|
|
6
7
|
import { AUTO_MODE_OPTION_ID as c, assistantModeMeta as l } from "./AssistantModeSelector.js";
|
|
7
|
-
import { TAB_STOP_SELECTOR as u, modeMenuItemKey as
|
|
8
|
+
import { TAB_STOP_SELECTOR as u, modeMenuItemKey as re, modeMenuOpenIndex as ie, modeMenuTriggerKey as ae, nextTabStop as d } from "./modeMenuKeys.js";
|
|
8
9
|
import { useCallback as f, useId as p, useRef as m, useState as h } from "react";
|
|
9
|
-
import { ChevronDown as
|
|
10
|
-
import { Fragment as
|
|
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
13
|
function v(e, t) {
|
|
13
14
|
return e(`mode.${t.id}`, t.label || l(t).fallback);
|
|
14
15
|
}
|
|
15
|
-
var
|
|
16
|
-
function
|
|
16
|
+
var ue = "[data-radix-focus-guard],[data-radix-menu-content]";
|
|
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 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);
|
|
23
24
|
k && C && A(!1);
|
|
24
|
-
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 ===
|
|
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) => {
|
|
25
26
|
if (e === L) {
|
|
26
27
|
let t = b.find((t) => t.id === e);
|
|
27
28
|
t?.writeCapable && x(t.id);
|
|
@@ -38,100 +39,103 @@ var y = ({ mode: y, availableModes: b, onModeChange: x, auto: S, disabled: C = !
|
|
|
38
39
|
b,
|
|
39
40
|
x,
|
|
40
41
|
L
|
|
41
|
-
]),
|
|
42
|
-
e && C || (e ? P.current = !0 : N.current = "checked", A(e));
|
|
43
|
-
}, [C]),
|
|
44
|
-
let t =
|
|
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) => {
|
|
45
|
+
let t = ae(e.key);
|
|
45
46
|
t !== null && (C ? e.preventDefault() : (N.current = t, e.key === "ArrowUp" && (e.preventDefault(), P.current = !0, A(!0))));
|
|
46
|
-
}, [C]),
|
|
47
|
+
}, [C]), ye = f((e) => {
|
|
47
48
|
C && e.preventDefault();
|
|
48
|
-
}, [C]),
|
|
49
|
+
}, [C]), G = f((e) => {
|
|
49
50
|
let t = j.current;
|
|
50
51
|
if (A(!1), !t) return;
|
|
51
|
-
let n = t.ownerDocument, r = Array.from(n.querySelectorAll(u)).filter((e) => !M.current.includes(e) && !e.closest(
|
|
52
|
+
let n = t.ownerDocument, r = Array.from(n.querySelectorAll(u)).filter((e) => !M.current.includes(e) && !e.closest(ue)), i = r.indexOf(t);
|
|
52
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 = M.current.slice(0, I.length), n = t.findIndex((t) => t !== null && t === e.target), r =
|
|
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
62
|
count: I.length
|
|
62
63
|
});
|
|
63
|
-
r.kind === "move" ? (e.preventDefault(), t[r.index]?.focus()) : r.kind === "tab-out" && (e.preventDefault(),
|
|
64
|
-
}, [I.length,
|
|
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) => {
|
|
65
66
|
if (!P.current || e.target !== e.currentTarget) return;
|
|
66
67
|
P.current = !1, e.preventDefault();
|
|
67
|
-
let t =
|
|
68
|
+
let t = ie(N.current, R, I.length);
|
|
68
69
|
N.current = "checked", M.current[t]?.focus();
|
|
69
|
-
}, [R, I.length]),
|
|
70
|
+
}, [R, I.length]), be = f((e) => {
|
|
70
71
|
let t = j.current;
|
|
71
|
-
t && !
|
|
72
|
-
}, []),
|
|
73
|
-
j.current?.focus(),
|
|
74
|
-
}, [
|
|
72
|
+
t && !ee(t.ownerDocument) && e.preventDefault();
|
|
73
|
+
}, []), xe = f((e) => {
|
|
74
|
+
j.current?.focus(), W(e);
|
|
75
|
+
}, [W]);
|
|
75
76
|
if (I.length === 0) return null;
|
|
76
|
-
let
|
|
77
|
+
let J = E("modeMenu.staticLabel", "Mode: {{mode}}", { mode: U }), Y = S?.active ? ce : l({ id: y }).icon;
|
|
77
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: w ? E("modeMenu.readOnlyHint", "Change the mode in the full assistant") :
|
|
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__ */ g(
|
|
84
|
+
/* @__PURE__ */ g(Y, {
|
|
84
85
|
className: "size-3.5 shrink-0",
|
|
85
86
|
"aria-hidden": "true"
|
|
86
87
|
}),
|
|
87
88
|
/* @__PURE__ */ g("span", {
|
|
88
89
|
className: "truncate",
|
|
89
90
|
"aria-hidden": "true",
|
|
90
|
-
children:
|
|
91
|
+
children: U
|
|
91
92
|
}),
|
|
92
93
|
/* @__PURE__ */ g("span", {
|
|
93
94
|
className: "sr-only",
|
|
94
95
|
"data-testid": "assistant-mode-static-label",
|
|
95
|
-
children:
|
|
96
|
+
children: J
|
|
96
97
|
})
|
|
97
98
|
]
|
|
98
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: E("modeMenu.staticLabel", "Mode: {{mode}}", { mode:
|
|
103
|
+
children: E("modeMenu.staticLabel", "Mode: {{mode}}", { mode: U })
|
|
103
104
|
});
|
|
104
|
-
let
|
|
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, {
|
|
106
|
+
className: "size-4 text-action-primary-bg",
|
|
107
|
+
"aria-hidden": "true"
|
|
108
|
+
}), $ = (e) => (t) => {
|
|
105
109
|
M.current[e] = t;
|
|
106
110
|
};
|
|
107
|
-
return /* @__PURE__ */ _(
|
|
111
|
+
return /* @__PURE__ */ _(le, { children: [/* @__PURE__ */ _(e, {
|
|
108
112
|
open: k,
|
|
109
|
-
onOpenChange:
|
|
113
|
+
onOpenChange: _e,
|
|
110
114
|
modal: !1,
|
|
111
115
|
children: [/* @__PURE__ */ g(i, {
|
|
112
116
|
asChild: !0,
|
|
113
117
|
children: /* @__PURE__ */ _("button", {
|
|
114
118
|
ref: j,
|
|
115
119
|
type: "button",
|
|
116
|
-
"aria-label": T ?
|
|
120
|
+
"aria-label": T ? J : E("modeMenu.trigger", "Assistant mode: {{mode}}", { mode: U }),
|
|
117
121
|
"aria-disabled": C || void 0,
|
|
118
122
|
"aria-describedby": C ? D : void 0,
|
|
119
|
-
title: C ?
|
|
120
|
-
onKeyDown:
|
|
121
|
-
onPointerDown:
|
|
123
|
+
title: C ? X : void 0,
|
|
124
|
+
onKeyDown: ve,
|
|
125
|
+
onPointerDown: ye,
|
|
122
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"}`,
|
|
123
127
|
"data-testid": "assistant-mode-selector",
|
|
124
128
|
"data-selected-mode-id": L,
|
|
125
129
|
children: [
|
|
126
|
-
/* @__PURE__ */ g(
|
|
130
|
+
/* @__PURE__ */ g(Y, {
|
|
127
131
|
className: "size-4 shrink-0 text-text-secondary",
|
|
128
132
|
"aria-hidden": "true"
|
|
129
133
|
}),
|
|
130
134
|
/* @__PURE__ */ g("span", {
|
|
131
135
|
className: "truncate",
|
|
132
|
-
children:
|
|
136
|
+
children: U
|
|
133
137
|
}),
|
|
134
|
-
/* @__PURE__ */ g(
|
|
138
|
+
/* @__PURE__ */ g(se, {
|
|
135
139
|
className: "size-4 shrink-0 text-text-muted",
|
|
136
140
|
"aria-hidden": "true"
|
|
137
141
|
})
|
|
@@ -140,25 +144,28 @@ var y = ({ mode: y, availableModes: b, onModeChange: x, auto: S, disabled: C = !
|
|
|
140
144
|
}), /* @__PURE__ */ g(t, {
|
|
141
145
|
side: "top",
|
|
142
146
|
align: "start",
|
|
143
|
-
sideOffset:
|
|
147
|
+
sideOffset: 10,
|
|
144
148
|
collisionPadding: 8,
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
+
collisionBoundary: pe,
|
|
150
|
+
avoidCollisions: !1,
|
|
151
|
+
onFocus: q,
|
|
152
|
+
onCloseAutoFocus: be,
|
|
153
|
+
onKeyDown: K,
|
|
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",
|
|
149
155
|
"data-testid": "assistant-mode-menu",
|
|
150
156
|
children: /* @__PURE__ */ _(n, {
|
|
151
157
|
value: L,
|
|
152
|
-
onValueChange:
|
|
158
|
+
onValueChange: xe,
|
|
153
159
|
children: [F ? /* @__PURE__ */ g(r, {
|
|
154
160
|
ref: $(0),
|
|
155
161
|
value: c,
|
|
156
|
-
onKeyDown:
|
|
162
|
+
onKeyDown: K,
|
|
157
163
|
"aria-labelledby": `${O}-label-0`,
|
|
158
164
|
"aria-describedby": `${O}-description-0`,
|
|
159
|
-
className:
|
|
165
|
+
className: Z,
|
|
166
|
+
indicator: Q,
|
|
160
167
|
"data-testid": "assistant-mode-auto",
|
|
161
|
-
"data-auto-routed": z ?
|
|
168
|
+
"data-auto-routed": z ? a : void 0,
|
|
162
169
|
children: /* @__PURE__ */ _("span", {
|
|
163
170
|
className: "flex min-w-0 flex-col",
|
|
164
171
|
children: [/* @__PURE__ */ g("span", {
|
|
@@ -169,18 +176,19 @@ var y = ({ mode: y, availableModes: b, onModeChange: x, auto: S, disabled: C = !
|
|
|
169
176
|
id: `${O}-description-0`,
|
|
170
177
|
className: "text-xs text-text-secondary",
|
|
171
178
|
"data-testid": "assistant-mode-description",
|
|
172
|
-
children:
|
|
179
|
+
children: he
|
|
173
180
|
})]
|
|
174
181
|
})
|
|
175
182
|
}) : null, b.map((e, t) => {
|
|
176
|
-
let n = t + +!!F, i = e.shortDescription?.trim() ?
|
|
183
|
+
let n = t + +!!F, i = e.shortDescription?.trim() ? ne(E, s(e.id), e.shortDescription) : null;
|
|
177
184
|
return /* @__PURE__ */ g(r, {
|
|
178
185
|
ref: $(n),
|
|
179
186
|
value: e.id,
|
|
180
|
-
onKeyDown:
|
|
187
|
+
onKeyDown: K,
|
|
181
188
|
"aria-labelledby": `${O}-label-${n}`,
|
|
182
189
|
"aria-describedby": i ? `${O}-description-${n}` : void 0,
|
|
183
|
-
className:
|
|
190
|
+
className: Z,
|
|
191
|
+
indicator: Q,
|
|
184
192
|
"data-testid": `assistant-mode-option-${e.id}`,
|
|
185
193
|
children: /* @__PURE__ */ _("span", {
|
|
186
194
|
className: "flex min-w-0 flex-col",
|
|
@@ -203,7 +211,7 @@ var y = ({ mode: y, availableModes: b, onModeChange: x, auto: S, disabled: C = !
|
|
|
203
211
|
id: D,
|
|
204
212
|
className: "sr-only",
|
|
205
213
|
"data-testid": "assistant-mode-disabled-reason",
|
|
206
|
-
children:
|
|
214
|
+
children: X
|
|
207
215
|
}) : null] });
|
|
208
216
|
};
|
|
209
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 };
|