@burdenoff/fe-libs 2026.1119.6 → 2026.1119.8
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/chrome/PersonaSurfaceControls.js +82 -189
- package/dist/chrome/PersonaViewsList.d.ts +28 -0
- package/dist/chrome/PersonaViewsList.js +139 -0
- package/dist/chrome/personaViewOptions.d.ts +8 -0
- package/dist/chrome/personaViewOptions.js +14 -0
- package/dist/chrome/shell/NewMenu.d.ts +13 -1
- package/dist/chrome/shell/NewMenu.js +27 -14
- package/dist/chrome/shell/ShellSidebar.js +159 -157
- package/dist/chrome/shell/SidebarProfileMenu.d.ts +36 -4
- package/dist/chrome/shell/SidebarProfileMenu.js +408 -313
- package/dist/chrome/shell/WorkspaceAccountCard.d.ts +22 -0
- package/dist/chrome/shell/WorkspaceAccountCard.js +107 -0
- package/dist/chrome/shell/WorkspaceMenu.js +140 -136
- package/dist/chrome/shell/pageHost.d.ts +19 -0
- package/dist/chrome/shell/pageHost.js +21 -0
- package/dist/chrome/shell/pageWidth.d.ts +39 -0
- package/dist/chrome/shell/pageWidth.js +18 -0
- package/dist/chrome/shell/shellSidebarAppearance.d.ts +4 -0
- package/dist/chrome/shell/shellSidebarAppearance.js +7 -0
- package/dist/chrome/shell/sidebarPopupPlacement.d.ts +21 -0
- package/dist/chrome/shell/sidebarPopupPlacement.js +28 -0
- package/dist/shared/backgrounds/BackgroundSettingsSection.d.ts +11 -0
- package/dist/shared/backgrounds/BackgroundSettingsSection.js +67 -0
- package/dist/shared/backgrounds/backgroundSectionLabels.d.ts +14 -0
- package/dist/shared/backgrounds/backgroundSectionLabels.js +36 -0
- package/dist/shared/backgrounds/index.d.ts +3 -0
- package/dist/shared/backgrounds/useStartPageBackground.d.ts +12 -0
- package/dist/shared/backgrounds/useStartPageBackground.js +23 -0
- package/dist/shared-backgrounds.js +4 -1
- package/dist/ui/dropdown-menu.d.ts +12 -2
- package/dist/ui/dropdown-menu.js +53 -50
- package/dist/ui/glass-surface.d.ts +7 -0
- package/dist/ui/glass-surface.js +14 -0
- package/dist/ui/popover.d.ts +1 -1
- package/dist/ui/popover.js +17 -15
- package/dist/ui/select.js +69 -68
- package/dist/ui/tooltip.d.ts +6 -0
- package/dist/ui/tooltip.js +18 -14
- package/package.json +5 -1
- package/src/shared/styles/page-widths.css +38 -0
- package/src/shared/tokens/build/brands/healthybowl.css +25 -3
- package/src/shared/tokens/display-settings.css +3 -0
|
@@ -2,31 +2,22 @@ import { interpolateShellLabel as e } from "../shared/providers/shell/interpolat
|
|
|
2
2
|
import { useSafePersonaSurface as t } from "../shared/providers/shell/PersonaSurfaceProvider.js";
|
|
3
3
|
import { useShellUi as n } from "../shared/providers/shell/ShellUiProvider.js";
|
|
4
4
|
import { useShellLabel as r } from "../shared/providers/shell/useShellLabel.js";
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
5
|
+
import { PersonaViewsList as i } from "./PersonaViewsList.js";
|
|
6
|
+
import { buildViewOptions as a } from "./personaViewOptions.js";
|
|
7
|
+
import { useCallback as o, useEffect as s, useRef as c, useState as l } from "react";
|
|
8
|
+
import { Check as u, ChevronsUpDown as d, Eye as f, SlidersHorizontal as p } from "lucide-react";
|
|
9
|
+
import { jsx as m, jsxs as h } from "react/jsx-runtime";
|
|
10
|
+
import { createPortal as g } from "react-dom";
|
|
9
11
|
// src/chrome/PersonaSurfaceControls.tsx
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
id: e,
|
|
17
|
-
label: a(e),
|
|
18
|
-
isOwnRole: e === i
|
|
19
|
-
}));
|
|
20
|
-
}
|
|
21
|
-
var y = 300;
|
|
22
|
-
function b({ everythingLabel: e, onOpenCustomize: n }) {
|
|
23
|
-
let p = r(), b = t(), [x, S] = s(!1), [C, w] = s(""), [T, E] = s(null), D = o(null), O = o(null), k = o(null), A = o(null), j = i(() => {
|
|
24
|
-
S(!1), w("");
|
|
25
|
-
}, []), M = i(() => {
|
|
26
|
-
let e = O.current?.getBoundingClientRect();
|
|
12
|
+
var _ = 300;
|
|
13
|
+
function v({ everythingLabel: e, onOpenCustomize: n }) {
|
|
14
|
+
let p = r(), v = t(), [y, b] = l(!1), [x, S] = l(""), [C, w] = l(null), T = c(null), E = c(null), D = c(null), O = c(null), k = o(() => {
|
|
15
|
+
b(!1), S("");
|
|
16
|
+
}, []), A = o(() => {
|
|
17
|
+
let e = E.current?.getBoundingClientRect();
|
|
27
18
|
if (!e) return;
|
|
28
|
-
let t = window.innerWidth, n = Math.min(Math.max(e.width,
|
|
29
|
-
|
|
19
|
+
let t = window.innerWidth, n = Math.min(Math.max(e.width, _), t - 16), r = Math.min(Math.max(8, e.left), t - n - 8);
|
|
20
|
+
w((t) => {
|
|
30
21
|
let i = window.innerHeight - e.top + 8;
|
|
31
22
|
return t && t.left === r && t.bottom === i && t.width === n ? t : {
|
|
32
23
|
left: r,
|
|
@@ -35,226 +26,128 @@ function b({ everythingLabel: e, onOpenCustomize: n }) {
|
|
|
35
26
|
};
|
|
36
27
|
});
|
|
37
28
|
}, []);
|
|
38
|
-
if (
|
|
39
|
-
if (!
|
|
40
|
-
|
|
29
|
+
if (s(() => {
|
|
30
|
+
if (!y) {
|
|
31
|
+
w(null);
|
|
41
32
|
return;
|
|
42
33
|
}
|
|
43
|
-
|
|
44
|
-
let e = typeof ResizeObserver < "u" &&
|
|
45
|
-
return e &&
|
|
46
|
-
window.removeEventListener("resize",
|
|
34
|
+
A(), window.addEventListener("resize", A), window.addEventListener("scroll", A, !0);
|
|
35
|
+
let e = typeof ResizeObserver < "u" && E.current ? new ResizeObserver(A) : null;
|
|
36
|
+
return e && E.current && e.observe(E.current), () => {
|
|
37
|
+
window.removeEventListener("resize", A), window.removeEventListener("scroll", A, !0), e?.disconnect();
|
|
47
38
|
};
|
|
48
|
-
}, [
|
|
49
|
-
if (!
|
|
39
|
+
}, [y, A]), s(() => {
|
|
40
|
+
if (!y) return;
|
|
50
41
|
let e = (e) => {
|
|
51
42
|
let t = e.target;
|
|
52
|
-
!
|
|
43
|
+
!T.current?.contains(t) && !D.current?.contains(t) && k();
|
|
53
44
|
};
|
|
54
45
|
return document.addEventListener("mousedown", e), document.addEventListener("touchstart", e), () => {
|
|
55
46
|
document.removeEventListener("mousedown", e), document.removeEventListener("touchstart", e);
|
|
56
47
|
};
|
|
57
|
-
}, [
|
|
58
|
-
|
|
59
|
-
}, [
|
|
60
|
-
let { activeSurfaceId:
|
|
61
|
-
|
|
62
|
-
},
|
|
63
|
-
e.key === "Escape" &&
|
|
64
|
-
},
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
return /* @__PURE__ */ _("div", {
|
|
68
|
-
ref: D,
|
|
48
|
+
}, [y, k]), s(() => {
|
|
49
|
+
y && O.current?.focus();
|
|
50
|
+
}, [y]), !v) return null;
|
|
51
|
+
let { activeSurfaceId: j, surfaces: M, canSimulate: N, simulation: P, loadSimulatableRoles: F, customViews: I } = v, L = a(v, e), R = P ? P.roleName : L.find((e) => e.id === j)?.label ?? M.find((e) => e.id === j)?.label ?? I.find((e) => e.id === j)?.name ?? e, z = () => {
|
|
52
|
+
y ? k() : (N && F(), b(!0));
|
|
53
|
+
}, B = (e) => {
|
|
54
|
+
e.key === "Escape" && y && (e.preventDefault(), e.stopPropagation(), k());
|
|
55
|
+
}, V = "flex w-full min-h-9 items-center gap-2 rounded-button px-2.5 py-1.5 text-start text-body-sm text-text-primary hover:bg-bg-sunken transition-colors";
|
|
56
|
+
return /* @__PURE__ */ h("div", {
|
|
57
|
+
ref: T,
|
|
69
58
|
className: "relative min-w-0 flex-1",
|
|
70
|
-
onKeyDown:
|
|
71
|
-
children: [
|
|
72
|
-
ref:
|
|
59
|
+
onKeyDown: B,
|
|
60
|
+
children: [y && C && typeof document < "u" && g(/* @__PURE__ */ m("div", {
|
|
61
|
+
ref: D,
|
|
73
62
|
style: {
|
|
74
|
-
left:
|
|
75
|
-
bottom:
|
|
76
|
-
width:
|
|
63
|
+
left: C.left,
|
|
64
|
+
bottom: C.bottom,
|
|
65
|
+
width: C.width
|
|
77
66
|
},
|
|
78
67
|
className: "fixed z-[130] flex max-h-80 flex-col overflow-hidden rounded-card border border-border-subtle bg-bg-canvas shadow-lg",
|
|
79
68
|
role: "listbox",
|
|
80
69
|
"data-testid": "persona-view-panel",
|
|
81
|
-
onKeyDown:
|
|
82
|
-
children:
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
return /* @__PURE__ */ _("button", {
|
|
102
|
-
type: "button",
|
|
103
|
-
onClick: () => Z(e.id),
|
|
104
|
-
className: Q,
|
|
105
|
-
"data-testid": `persona-view-${e.id}`,
|
|
106
|
-
children: [
|
|
107
|
-
/* @__PURE__ */ g(c, { className: `size-4 flex-shrink-0 ${t ? "text-text-primary" : "invisible"}` }),
|
|
108
|
-
/* @__PURE__ */ g("span", {
|
|
109
|
-
className: "truncate",
|
|
110
|
-
children: e.label
|
|
111
|
-
}),
|
|
112
|
-
e.isOwnRole && /* @__PURE__ */ g("span", {
|
|
113
|
-
className: "ms-auto flex-shrink-0 rounded-full bg-bg-sunken px-2 py-0.5 text-[11px] text-text-secondary",
|
|
114
|
-
children: p("nav.yourRole", "Your role")
|
|
115
|
-
})
|
|
116
|
-
]
|
|
117
|
-
}, e.id);
|
|
118
|
-
}),
|
|
119
|
-
(q.length > 0 || U && !G) && /* @__PURE__ */ _(h, { children: [
|
|
120
|
-
/* @__PURE__ */ g("p", {
|
|
121
|
-
className: $,
|
|
122
|
-
children: p("nav.myViews", "My views")
|
|
123
|
-
}),
|
|
124
|
-
q.map((e) => {
|
|
125
|
-
let t = !R && e.id === N;
|
|
126
|
-
return /* @__PURE__ */ _("button", {
|
|
127
|
-
type: "button",
|
|
128
|
-
onClick: () => Z(e.id),
|
|
129
|
-
className: Q,
|
|
130
|
-
"data-testid": `persona-view-${e.id}`,
|
|
131
|
-
children: [/* @__PURE__ */ g(c, { className: `size-4 flex-shrink-0 ${t ? "text-text-primary" : "invisible"}` }), /* @__PURE__ */ g("span", {
|
|
132
|
-
className: "truncate",
|
|
133
|
-
children: e.name
|
|
134
|
-
})]
|
|
135
|
-
}, e.id);
|
|
136
|
-
}),
|
|
137
|
-
U && !G && /* @__PURE__ */ _("button", {
|
|
138
|
-
type: "button",
|
|
139
|
-
onClick: () => {
|
|
140
|
-
j(), n();
|
|
141
|
-
},
|
|
142
|
-
className: `${Q} text-text-secondary`,
|
|
143
|
-
"data-testid": "persona-view-create",
|
|
144
|
-
children: [/* @__PURE__ */ g(d, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ g("span", { children: p("nav.newViewFromCurrent", "New view from current…") })]
|
|
145
|
-
})
|
|
146
|
-
] }),
|
|
147
|
-
L && /* @__PURE__ */ _(h, { children: [
|
|
148
|
-
/* @__PURE__ */ g("p", {
|
|
149
|
-
className: $,
|
|
150
|
-
children: p("nav.previewARole", "Preview a role")
|
|
151
|
-
}),
|
|
152
|
-
R && /* @__PURE__ */ _("button", {
|
|
153
|
-
type: "button",
|
|
154
|
-
onClick: () => {
|
|
155
|
-
z(), j();
|
|
156
|
-
},
|
|
157
|
-
className: `${Q} text-status-warning-text`,
|
|
158
|
-
"data-testid": "persona-view-exit-preview",
|
|
159
|
-
children: [/* @__PURE__ */ g(m, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ g("span", { children: p("nav.exitPreview", "Exit preview") })]
|
|
160
|
-
}),
|
|
161
|
-
V && /* @__PURE__ */ g("p", {
|
|
162
|
-
className: "px-2.5 py-1.5 text-body-sm text-text-muted",
|
|
163
|
-
children: p("inviteMemberDialog.loadingRoles", "Loading roles…")
|
|
164
|
-
}),
|
|
165
|
-
J.map((e) => {
|
|
166
|
-
let t = R?.roleId === e.id;
|
|
167
|
-
return /* @__PURE__ */ _("button", {
|
|
168
|
-
type: "button",
|
|
169
|
-
onClick: () => {
|
|
170
|
-
te(e), j();
|
|
171
|
-
},
|
|
172
|
-
className: Q,
|
|
173
|
-
"data-testid": `persona-preview-${e.id}`,
|
|
174
|
-
children: [
|
|
175
|
-
/* @__PURE__ */ g(u, { className: `size-4 flex-shrink-0 ${t ? "text-status-warning-text" : "text-text-muted"}` }),
|
|
176
|
-
/* @__PURE__ */ g("span", {
|
|
177
|
-
className: "truncate",
|
|
178
|
-
children: e.name
|
|
179
|
-
}),
|
|
180
|
-
t && /* @__PURE__ */ g(c, { className: "ms-auto size-4 flex-shrink-0" })
|
|
181
|
-
]
|
|
182
|
-
}, e.id);
|
|
183
|
-
}),
|
|
184
|
-
!V && J.length === 0 && G && /* @__PURE__ */ g("p", {
|
|
185
|
-
className: "px-2.5 py-1.5 text-body-sm text-text-muted",
|
|
186
|
-
children: p("nav.noMatchingRoles", "No matching roles")
|
|
187
|
-
})
|
|
188
|
-
] }),
|
|
189
|
-
K.length === 0 && (!L || J.length === 0) && G && /* @__PURE__ */ g("p", {
|
|
190
|
-
className: "px-2.5 py-1.5 text-body-sm text-text-muted",
|
|
191
|
-
children: p("conversations.empty.search.title", "No matches")
|
|
192
|
-
})
|
|
193
|
-
]
|
|
194
|
-
})]
|
|
195
|
-
}), document.body), /* @__PURE__ */ _("button", {
|
|
196
|
-
ref: O,
|
|
70
|
+
onKeyDown: B,
|
|
71
|
+
children: /* @__PURE__ */ m(i, {
|
|
72
|
+
persona: v,
|
|
73
|
+
everythingLabel: e,
|
|
74
|
+
query: x,
|
|
75
|
+
onQueryChange: S,
|
|
76
|
+
close: k,
|
|
77
|
+
onOpenCustomize: n,
|
|
78
|
+
searchRef: O,
|
|
79
|
+
sectionClass: "px-2.5 pb-1 pt-2.5 text-[11px] font-medium uppercase tracking-wider text-text-muted",
|
|
80
|
+
renderRow: ({ testId: e, onSelect: t, tone: n = "default", children: r }) => /* @__PURE__ */ m("button", {
|
|
81
|
+
type: "button",
|
|
82
|
+
onClick: t,
|
|
83
|
+
className: n === "muted" ? `${V} text-text-secondary` : n === "warning" ? `${V} text-status-warning-text` : V,
|
|
84
|
+
"data-testid": e,
|
|
85
|
+
children: r
|
|
86
|
+
}, e)
|
|
87
|
+
})
|
|
88
|
+
}), document.body), /* @__PURE__ */ h("button", {
|
|
89
|
+
ref: E,
|
|
197
90
|
type: "button",
|
|
198
|
-
onClick:
|
|
199
|
-
"aria-expanded":
|
|
91
|
+
onClick: z,
|
|
92
|
+
"aria-expanded": y,
|
|
200
93
|
"aria-haspopup": "listbox",
|
|
201
|
-
className: `flex w-full min-h-9 items-center gap-2 rounded-button border px-2.5 py-1.5 text-body-sm transition-colors ${
|
|
94
|
+
className: `flex w-full min-h-9 items-center gap-2 rounded-button border px-2.5 py-1.5 text-body-sm transition-colors ${P ? "border-status-warning-text/40 bg-status-warning-bg-subtle text-text-primary" : "border-border-subtle bg-bg-canvas text-text-primary hover:bg-bg-sunken"}`,
|
|
202
95
|
"data-testid": "persona-view-trigger",
|
|
203
96
|
children: [
|
|
204
|
-
|
|
205
|
-
/* @__PURE__ */
|
|
97
|
+
P ? /* @__PURE__ */ m(f, { className: "size-4 flex-shrink-0 text-status-warning-text" }) : /* @__PURE__ */ m(u, { className: "size-4 flex-shrink-0 text-text-muted" }),
|
|
98
|
+
/* @__PURE__ */ m("span", {
|
|
206
99
|
className: "min-w-0 flex-1 truncate text-start",
|
|
207
|
-
children:
|
|
100
|
+
children: P ? p("nav.previewNamedView", "Preview: {{name}}", { name: R }) : R
|
|
208
101
|
}),
|
|
209
|
-
/* @__PURE__ */
|
|
102
|
+
/* @__PURE__ */ m(d, { className: "size-4 flex-shrink-0 text-text-muted" })
|
|
210
103
|
]
|
|
211
104
|
})]
|
|
212
105
|
});
|
|
213
106
|
}
|
|
214
|
-
function
|
|
107
|
+
function y({ everythingLabel: e, customizeLabel: i }) {
|
|
215
108
|
let a = t(), { sidebarCollapsed: o, toggleSidebar: s } = n(), c = r(), l = e ?? c("nav.everything", "Everything"), u = i ?? c("nav.customizeMenu", "Customize menu");
|
|
216
109
|
if (!a) return null;
|
|
217
110
|
let { setCustomizeOpen: d } = a, f = () => {
|
|
218
111
|
typeof window < "u" && window.innerWidth < 768 && !o && s(), d(!0);
|
|
219
|
-
},
|
|
112
|
+
}, g = /* @__PURE__ */ m("button", {
|
|
220
113
|
type: "button",
|
|
221
114
|
onClick: f,
|
|
222
115
|
className: "p-2 rounded-button text-text-secondary hover:bg-bg-sunken hover:text-text-primary transition-colors flex-shrink-0",
|
|
223
116
|
"aria-label": u,
|
|
224
117
|
title: u,
|
|
225
118
|
"data-testid": "persona-customize-trigger",
|
|
226
|
-
children: /* @__PURE__ */
|
|
119
|
+
children: /* @__PURE__ */ m(p, { className: "size-4" })
|
|
227
120
|
});
|
|
228
|
-
return o ? /* @__PURE__ */
|
|
121
|
+
return o ? /* @__PURE__ */ m("div", {
|
|
229
122
|
className: "hidden md:flex justify-center",
|
|
230
123
|
"data-testid": "persona-controls-collapsed",
|
|
231
|
-
children:
|
|
232
|
-
}) : /* @__PURE__ */
|
|
124
|
+
children: g
|
|
125
|
+
}) : /* @__PURE__ */ h("div", {
|
|
233
126
|
className: "flex items-center gap-1",
|
|
234
127
|
"data-testid": "persona-controls",
|
|
235
|
-
children: [/* @__PURE__ */
|
|
128
|
+
children: [/* @__PURE__ */ m(v, {
|
|
236
129
|
everythingLabel: l,
|
|
237
130
|
onOpenCustomize: f
|
|
238
|
-
}),
|
|
131
|
+
}), g]
|
|
239
132
|
});
|
|
240
133
|
}
|
|
241
|
-
function
|
|
134
|
+
function b() {
|
|
242
135
|
let n = r(), i = t();
|
|
243
|
-
return i?.simulation ? /* @__PURE__ */
|
|
136
|
+
return i?.simulation ? /* @__PURE__ */ h("div", {
|
|
244
137
|
className: "fixed bottom-4 left-1/2 z-[120] -translate-x-1/2 flex max-w-[calc(100vw-2rem)] items-center gap-2 rounded-full border border-border-subtle bg-bg-canvas px-4 py-2 shadow-lg",
|
|
245
138
|
style: { marginBottom: "env(safe-area-inset-bottom)" },
|
|
246
139
|
role: "status",
|
|
247
140
|
"data-testid": "persona-simulation-pill",
|
|
248
141
|
children: [
|
|
249
|
-
/* @__PURE__ */
|
|
250
|
-
/* @__PURE__ */
|
|
142
|
+
/* @__PURE__ */ m(f, { className: "size-4 flex-shrink-0 text-status-warning-text" }),
|
|
143
|
+
/* @__PURE__ */ m("span", {
|
|
251
144
|
className: "truncate text-body-sm text-text-primary",
|
|
252
|
-
children: e(n("nav.simulationSummary", "Viewing as {{role}} (simulated)"), { role: /* @__PURE__ */
|
|
145
|
+
children: e(n("nav.simulationSummary", "Viewing as {{role}} (simulated)"), { role: /* @__PURE__ */ m("span", {
|
|
253
146
|
className: "font-semibold",
|
|
254
147
|
children: i.simulation.roleName
|
|
255
148
|
}) })
|
|
256
149
|
}),
|
|
257
|
-
/* @__PURE__ */
|
|
150
|
+
/* @__PURE__ */ m("button", {
|
|
258
151
|
type: "button",
|
|
259
152
|
onClick: i.stopSimulation,
|
|
260
153
|
className: "rounded-full px-2 py-0.5 text-body-sm font-medium text-text-secondary hover:bg-bg-sunken hover:text-text-primary transition-colors",
|
|
@@ -264,4 +157,4 @@ function S() {
|
|
|
264
157
|
]
|
|
265
158
|
}) : null;
|
|
266
159
|
}
|
|
267
|
-
export {
|
|
160
|
+
export { b as PersonaSimulationPill, y as PersonaSurfaceControls };
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { KeyboardEvent as ReactKeyboardEvent, ReactElement, ReactNode, RefObject } from 'react';
|
|
2
|
+
import { PersonaSurfaceContextValue } from '../shared/providers/shell/PersonaSurfaceProvider';
|
|
3
|
+
/** How the caller draws one row. `tone` is the row's text colour; `children` its content. */
|
|
4
|
+
export interface PersonaRowProps {
|
|
5
|
+
testId: string;
|
|
6
|
+
onSelect: () => void;
|
|
7
|
+
tone?: 'default' | 'muted' | 'warning';
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
}
|
|
10
|
+
export type PersonaRowRenderer = (row: PersonaRowProps) => ReactElement;
|
|
11
|
+
export interface PersonaViewsListProps {
|
|
12
|
+
persona: PersonaSurfaceContextValue;
|
|
13
|
+
everythingLabel: string;
|
|
14
|
+
query: string;
|
|
15
|
+
onQueryChange: (query: string) => void;
|
|
16
|
+
/** Called after a row acts (the caller closes its container and clears the query). */
|
|
17
|
+
close: () => void;
|
|
18
|
+
/** "New view from current…": the caller opens the customize dialog. */
|
|
19
|
+
onOpenCustomize: () => void;
|
|
20
|
+
renderRow: PersonaRowRenderer;
|
|
21
|
+
searchRef?: RefObject<HTMLInputElement | null>;
|
|
22
|
+
/** Escape in the search box, so the caller can consume it. */
|
|
23
|
+
onSearchKeyDown?: (event: ReactKeyboardEvent<HTMLInputElement>) => void;
|
|
24
|
+
/** The section caption classes of the caller's surface. */
|
|
25
|
+
sectionClass: string;
|
|
26
|
+
}
|
|
27
|
+
/** The search row and the scrolling list, as two siblings for the caller's container. */
|
|
28
|
+
export declare function PersonaViewsList({ persona, everythingLabel, query, onQueryChange, close, onOpenCustomize, renderRow, searchRef, onSearchKeyDown, sectionClass, }: PersonaViewsListProps): import('react').JSX.Element;
|
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { useShellLabel as e } from "../shared/providers/shell/useShellLabel.js";
|
|
2
|
+
import { buildViewOptions as t } from "./personaViewOptions.js";
|
|
3
|
+
import { Check as n, Eye as r, Plus as i, Search as a, X as o } from "lucide-react";
|
|
4
|
+
import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
5
|
+
// src/chrome/PersonaViewsList.tsx
|
|
6
|
+
var u = (e, t) => !t || e.toLowerCase().includes(t);
|
|
7
|
+
function d({ selected: e }) {
|
|
8
|
+
return /* @__PURE__ */ c(n, { className: `size-4 flex-shrink-0 ${e ? "text-text-primary" : "invisible"}` });
|
|
9
|
+
}
|
|
10
|
+
function f({ persona: n, everythingLabel: r, q: i, sectionClass: a, renderRow: o, pickView: f }) {
|
|
11
|
+
let p = e(), { activeSurfaceId: m, simulation: h } = n, g = t(n, r).filter((e) => u(e.label, i));
|
|
12
|
+
return /* @__PURE__ */ l(s, { children: [g.length > 0 && /* @__PURE__ */ c("p", {
|
|
13
|
+
className: a,
|
|
14
|
+
children: p("nav.views", "Views")
|
|
15
|
+
}), g.map((e) => o({
|
|
16
|
+
testId: `persona-view-${e.id}`,
|
|
17
|
+
onSelect: () => f(e.id),
|
|
18
|
+
children: /* @__PURE__ */ l(s, { children: [
|
|
19
|
+
/* @__PURE__ */ c(d, { selected: !h && e.id === m }),
|
|
20
|
+
/* @__PURE__ */ c("span", {
|
|
21
|
+
className: "truncate",
|
|
22
|
+
children: e.label
|
|
23
|
+
}),
|
|
24
|
+
e.isOwnRole && /* @__PURE__ */ c("span", {
|
|
25
|
+
className: "ms-auto flex-shrink-0 rounded-full bg-bg-sunken px-2 py-0.5 text-[11px] text-text-secondary",
|
|
26
|
+
children: p("nav.yourRole", "Your role")
|
|
27
|
+
})
|
|
28
|
+
] })
|
|
29
|
+
}))] });
|
|
30
|
+
}
|
|
31
|
+
function p({ persona: t, q: n, sectionClass: r, renderRow: a, pickView: o, close: f, onOpenCustomize: p }) {
|
|
32
|
+
let m = e(), { activeSurfaceId: h, simulation: g, customViews: _, canManageViews: v } = t, y = _.filter((e) => u(e.name, n)), b = v && !n;
|
|
33
|
+
return y.length === 0 && !b ? null : /* @__PURE__ */ l(s, { children: [
|
|
34
|
+
/* @__PURE__ */ c("p", {
|
|
35
|
+
className: r,
|
|
36
|
+
children: m("nav.myViews", "My views")
|
|
37
|
+
}),
|
|
38
|
+
y.map((e) => a({
|
|
39
|
+
testId: `persona-view-${e.id}`,
|
|
40
|
+
onSelect: () => o(e.id),
|
|
41
|
+
children: /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(d, { selected: !g && e.id === h }), /* @__PURE__ */ c("span", {
|
|
42
|
+
className: "truncate",
|
|
43
|
+
children: e.name
|
|
44
|
+
})] })
|
|
45
|
+
})),
|
|
46
|
+
b && a({
|
|
47
|
+
testId: "persona-view-create",
|
|
48
|
+
tone: "muted",
|
|
49
|
+
onSelect: () => {
|
|
50
|
+
f(), p();
|
|
51
|
+
},
|
|
52
|
+
children: /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(i, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ c("span", { children: m("nav.newViewFromCurrent", "New view from current…") })] })
|
|
53
|
+
})
|
|
54
|
+
] });
|
|
55
|
+
}
|
|
56
|
+
function m({ persona: t, q: i, sectionClass: a, renderRow: d, close: f }) {
|
|
57
|
+
let p = e(), { simulation: m, stopSimulation: h, startSimulation: g, simulatableRoles: _, simulatableRolesLoading: v } = t, y = _.filter((e) => u(e.name, i));
|
|
58
|
+
return /* @__PURE__ */ l(s, { children: [
|
|
59
|
+
/* @__PURE__ */ c("p", {
|
|
60
|
+
className: a,
|
|
61
|
+
children: p("nav.previewARole", "Preview a role")
|
|
62
|
+
}),
|
|
63
|
+
m && d({
|
|
64
|
+
testId: "persona-view-exit-preview",
|
|
65
|
+
tone: "warning",
|
|
66
|
+
onSelect: () => {
|
|
67
|
+
h(), f();
|
|
68
|
+
},
|
|
69
|
+
children: /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ c(o, { className: "size-4 flex-shrink-0" }), /* @__PURE__ */ c("span", { children: p("nav.exitPreview", "Exit preview") })] })
|
|
70
|
+
}),
|
|
71
|
+
v && /* @__PURE__ */ c("p", {
|
|
72
|
+
className: "px-2.5 py-1.5 text-body-sm text-text-muted",
|
|
73
|
+
children: p("inviteMemberDialog.loadingRoles", "Loading roles…")
|
|
74
|
+
}),
|
|
75
|
+
y.map((e) => {
|
|
76
|
+
let t = m?.roleId === e.id;
|
|
77
|
+
return d({
|
|
78
|
+
testId: `persona-preview-${e.id}`,
|
|
79
|
+
onSelect: () => {
|
|
80
|
+
g(e), f();
|
|
81
|
+
},
|
|
82
|
+
children: /* @__PURE__ */ l(s, { children: [
|
|
83
|
+
/* @__PURE__ */ c(r, { className: `size-4 flex-shrink-0 ${t ? "text-status-warning-text" : "text-text-muted"}` }),
|
|
84
|
+
/* @__PURE__ */ c("span", {
|
|
85
|
+
className: "truncate",
|
|
86
|
+
children: e.name
|
|
87
|
+
}),
|
|
88
|
+
t && /* @__PURE__ */ c(n, { className: "ms-auto size-4 flex-shrink-0" })
|
|
89
|
+
] })
|
|
90
|
+
});
|
|
91
|
+
}),
|
|
92
|
+
!v && y.length === 0 && i && /* @__PURE__ */ c("p", {
|
|
93
|
+
className: "px-2.5 py-1.5 text-body-sm text-text-muted",
|
|
94
|
+
children: p("nav.noMatchingRoles", "No matching roles")
|
|
95
|
+
})
|
|
96
|
+
] });
|
|
97
|
+
}
|
|
98
|
+
function h({ persona: n, everythingLabel: r, query: i, onQueryChange: o, close: d, onOpenCustomize: h, renderRow: g, searchRef: _, onSearchKeyDown: v, sectionClass: y }) {
|
|
99
|
+
let b = e(), { resolvedSurfaceId: x, setSurfaceId: S, canSimulate: C, simulation: w, stopSimulation: T } = n, E = i.trim().toLowerCase(), D = {
|
|
100
|
+
persona: n,
|
|
101
|
+
q: E,
|
|
102
|
+
sectionClass: y,
|
|
103
|
+
renderRow: g,
|
|
104
|
+
pickView: (e) => {
|
|
105
|
+
w && T(), S(e === x ? null : e), d();
|
|
106
|
+
},
|
|
107
|
+
close: d
|
|
108
|
+
}, O = E !== "" && t(n, r).every((e) => !u(e.label, E)), k = !C || n.simulatableRoles.every((e) => !u(e.name, E)), A = n.customViews.every((e) => !u(e.name, E));
|
|
109
|
+
return /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ l("div", {
|
|
110
|
+
className: "flex items-center gap-2 border-b border-border-subtle px-2.5 py-2",
|
|
111
|
+
children: [/* @__PURE__ */ c(a, { className: "size-4 flex-shrink-0 text-text-muted" }), /* @__PURE__ */ c("input", {
|
|
112
|
+
ref: _,
|
|
113
|
+
value: i,
|
|
114
|
+
onChange: (e) => o(e.target.value),
|
|
115
|
+
onKeyDown: v,
|
|
116
|
+
placeholder: b("nav.searchViewsRoles", "Search views & roles"),
|
|
117
|
+
className: "w-full bg-transparent text-body-sm text-text-primary outline-none placeholder:text-text-muted",
|
|
118
|
+
"data-testid": "persona-view-search"
|
|
119
|
+
})]
|
|
120
|
+
}), /* @__PURE__ */ l("div", {
|
|
121
|
+
className: "overflow-y-auto py-1",
|
|
122
|
+
children: [
|
|
123
|
+
/* @__PURE__ */ c(f, {
|
|
124
|
+
...D,
|
|
125
|
+
everythingLabel: r
|
|
126
|
+
}),
|
|
127
|
+
/* @__PURE__ */ c(p, {
|
|
128
|
+
...D,
|
|
129
|
+
onOpenCustomize: h
|
|
130
|
+
}),
|
|
131
|
+
C && /* @__PURE__ */ c(m, { ...D }),
|
|
132
|
+
O && k && A && /* @__PURE__ */ c("p", {
|
|
133
|
+
className: "px-2.5 py-1.5 text-body-sm text-text-muted",
|
|
134
|
+
children: b("conversations.empty.search.title", "No matches")
|
|
135
|
+
})
|
|
136
|
+
]
|
|
137
|
+
})] });
|
|
138
|
+
}
|
|
139
|
+
export { h as PersonaViewsList };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { PersonaSurfaceContextValue } from '../shared/providers/shell/PersonaSurfaceProvider';
|
|
2
|
+
export interface ViewOption {
|
|
3
|
+
id: string;
|
|
4
|
+
label: string;
|
|
5
|
+
/** The view the user's role resolves to: marked "Your role". */
|
|
6
|
+
isOwnRole: boolean;
|
|
7
|
+
}
|
|
8
|
+
export declare function buildViewOptions(persona: PersonaSurfaceContextValue, everythingLabel: string): ViewOption[];
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import "../shared/providers/shell/PersonaSurfaceProvider.js";
|
|
2
|
+
// src/chrome/personaViewOptions.ts
|
|
3
|
+
function e(e, t) {
|
|
4
|
+
let { surfaces: n, availableSurfaceIds: r, roleSurfaceId: i } = e, a = (e) => e === "everything" ? t : n.find((t) => t.id === e)?.label ?? e, o = [...r];
|
|
5
|
+
return o.sort((e, t) => {
|
|
6
|
+
let n = (e) => e === i ? 0 : e === "everything" ? 2 : 1;
|
|
7
|
+
return n(e) - n(t);
|
|
8
|
+
}), o.map((e) => ({
|
|
9
|
+
id: e,
|
|
10
|
+
label: a(e),
|
|
11
|
+
isOwnRole: e === i
|
|
12
|
+
}));
|
|
13
|
+
}
|
|
14
|
+
export { e as buildViewOptions };
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { ShellMenuItem, ShellSidebarAppearance } from './types';
|
|
2
|
+
export interface NewMenuSection {
|
|
3
|
+
/** Stable id; the caption's test id is `shell-new-section-<id>`. */
|
|
4
|
+
id: string;
|
|
5
|
+
/** The caption (already translated). */
|
|
6
|
+
label: string;
|
|
7
|
+
items: ShellMenuItem[];
|
|
8
|
+
}
|
|
2
9
|
export interface NewMenuProps {
|
|
3
10
|
items: ShellMenuItem[];
|
|
4
11
|
moreItems?: ShellMenuItem[];
|
|
12
|
+
/**
|
|
13
|
+
* BOFF-15549, opt-in: labelled groups (e.g. Record / Add / More) drawn after `items` and
|
|
14
|
+
* before `moreItems`, each under its caption. Unset or empty: nothing is added.
|
|
15
|
+
*/
|
|
16
|
+
sections?: NewMenuSection[];
|
|
5
17
|
collapsed?: boolean;
|
|
6
18
|
/**
|
|
7
19
|
* BOFF-15168: `floating` makes the expanded button 32 px tall, matching the
|
|
@@ -9,4 +21,4 @@ export interface NewMenuProps {
|
|
|
9
21
|
*/
|
|
10
22
|
appearance?: ShellSidebarAppearance;
|
|
11
23
|
}
|
|
12
|
-
export declare function NewMenu({ items, moreItems, collapsed, appearance, }: NewMenuProps): import('react').JSX.Element;
|
|
24
|
+
export declare function NewMenu({ items, moreItems, sections, collapsed, appearance, }: NewMenuProps): import('react').JSX.Element;
|
|
@@ -30,11 +30,11 @@ function y(e) {
|
|
|
30
30
|
]
|
|
31
31
|
}, e.id);
|
|
32
32
|
}
|
|
33
|
-
function b({ items: a, moreItems: o = [],
|
|
34
|
-
let
|
|
33
|
+
function b({ items: a, moreItems: o = [], sections: _ = [], collapsed: b = !1, appearance: x = "default" }) {
|
|
34
|
+
let S = t(), C = S("shell.newMenu.new", "New"), w = S("shell.newMenu.label", "Create something new");
|
|
35
35
|
return /* @__PURE__ */ m(r, {
|
|
36
36
|
modal: !1,
|
|
37
|
-
children: [
|
|
37
|
+
children: [b ? /* @__PURE__ */ m(c, {
|
|
38
38
|
delayDuration: 200,
|
|
39
39
|
children: [/* @__PURE__ */ p(u, {
|
|
40
40
|
asChild: !0,
|
|
@@ -42,7 +42,7 @@ function b({ items: a, moreItems: o = [], collapsed: _ = !1, appearance: b = "de
|
|
|
42
42
|
asChild: !0,
|
|
43
43
|
children: /* @__PURE__ */ p("button", {
|
|
44
44
|
type: "button",
|
|
45
|
-
"aria-label":
|
|
45
|
+
"aria-label": C,
|
|
46
46
|
"data-testid": "shell-new-trigger",
|
|
47
47
|
className: "flex size-10 items-center justify-center rounded-button text-text-secondary outline-none transition-colors hover:bg-bg-sunken hover:text-text-primary focus-visible:ring-2 focus-visible:ring-focus-ring data-[state=open]:bg-bg-sunken",
|
|
48
48
|
children: /* @__PURE__ */ p(d, {
|
|
@@ -55,7 +55,7 @@ function b({ items: a, moreItems: o = [], collapsed: _ = !1, appearance: b = "de
|
|
|
55
55
|
side: "right",
|
|
56
56
|
sideOffset: 10,
|
|
57
57
|
className: "rounded-md border border-border-subtle bg-popover px-2 py-1 text-text-primary shadow-overlay",
|
|
58
|
-
children:
|
|
58
|
+
children: C
|
|
59
59
|
})]
|
|
60
60
|
}) : /* @__PURE__ */ p(s, {
|
|
61
61
|
asChild: !0,
|
|
@@ -63,21 +63,34 @@ function b({ items: a, moreItems: o = [], collapsed: _ = !1, appearance: b = "de
|
|
|
63
63
|
type: "button",
|
|
64
64
|
size: "sm",
|
|
65
65
|
"data-testid": "shell-new-trigger",
|
|
66
|
-
className: h[
|
|
67
|
-
children: [/* @__PURE__ */ p(d, { "aria-hidden": "true" }),
|
|
66
|
+
className: h[x],
|
|
67
|
+
children: [/* @__PURE__ */ p(d, { "aria-hidden": "true" }), C]
|
|
68
68
|
})
|
|
69
69
|
}), /* @__PURE__ */ m(i, {
|
|
70
|
-
side:
|
|
70
|
+
side: b ? "right" : "bottom",
|
|
71
71
|
align: "start",
|
|
72
72
|
sideOffset: 6,
|
|
73
|
-
"aria-label":
|
|
73
|
+
"aria-label": w,
|
|
74
74
|
"data-testid": "shell-new-menu",
|
|
75
75
|
className: e(g, "w-[290px]"),
|
|
76
|
-
children: [
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
76
|
+
children: [
|
|
77
|
+
a.map(y),
|
|
78
|
+
_.filter((e) => e.items.length > 0).map((e) => /* @__PURE__ */ m("div", {
|
|
79
|
+
role: "group",
|
|
80
|
+
"aria-label": e.label,
|
|
81
|
+
children: [/* @__PURE__ */ p("div", {
|
|
82
|
+
role: "presentation",
|
|
83
|
+
className: v,
|
|
84
|
+
"data-testid": `shell-new-section-${e.id}`,
|
|
85
|
+
children: e.label
|
|
86
|
+
}), e.items.map(y)]
|
|
87
|
+
}, e.id)),
|
|
88
|
+
o.length > 0 && /* @__PURE__ */ m(f, { children: [/* @__PURE__ */ p("div", {
|
|
89
|
+
role: "presentation",
|
|
90
|
+
className: v,
|
|
91
|
+
children: S("shell.newMenu.more", "More")
|
|
92
|
+
}), o.map(y)] })
|
|
93
|
+
]
|
|
81
94
|
})]
|
|
82
95
|
});
|
|
83
96
|
}
|