@burdenoff/fe-libs 2026.1117.3 → 2026.1117.4

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.
Files changed (30) hide show
  1. package/dist/shared/assistant/i18nManifest.d.ts +21 -1
  2. package/dist/shared/assistant/i18nManifest.js +22 -2
  3. package/dist/shared/assistant/index.d.ts +8 -0
  4. package/dist/shared/assistant/ui/AIAssistantPanel.js +195 -194
  5. package/dist/shared/assistant/ui/AssistantChatArea.js +1339 -1332
  6. package/dist/shared/assistant/ui/compact/AssistantLanguagePill.d.ts +12 -0
  7. package/dist/shared/assistant/ui/compact/AssistantLanguagePill.js +13 -14
  8. package/dist/shared/assistant/ui/compact/AssistantWindowHeader.d.ts +8 -2
  9. package/dist/shared/assistant/ui/compact/AssistantWindowHeader.js +45 -39
  10. package/dist/shared/assistant/ui/compact/AssistantWindowWelcome.d.ts +44 -0
  11. package/dist/shared/assistant/ui/compact/AssistantWindowWelcome.js +110 -0
  12. package/dist/shared/assistant/ui/compact/AssistantWindowWelcomeCard.d.ts +29 -0
  13. package/dist/shared/assistant/ui/compact/AssistantWindowWelcomeCard.js +84 -0
  14. package/dist/shared/assistant/ui/compact/AssistantWindowWelcomeHero.d.ts +15 -0
  15. package/dist/shared/assistant/ui/compact/AssistantWindowWelcomeHero.js +64 -0
  16. package/dist/shared/assistant/ui/compact/AssistantWindowWelcomeSuggestions.d.ts +12 -0
  17. package/dist/shared/assistant/ui/compact/AssistantWindowWelcomeSuggestions.js +31 -0
  18. package/dist/shared/assistant/ui/compact/AssistantWindowWelcomeTips.d.ts +9 -0
  19. package/dist/shared/assistant/ui/compact/AssistantWindowWelcomeTips.js +37 -0
  20. package/dist/shared/assistant/ui/compact/windowTitle.d.ts +15 -0
  21. package/dist/shared/assistant/ui/compact/windowTitle.js +13 -0
  22. package/dist/shared/assistant/ui/compact/windowWelcome.d.ts +136 -0
  23. package/dist/shared/assistant/ui/compact/windowWelcome.js +119 -0
  24. package/dist/shared/assistant/ui/compact/windowWelcomeHooks.d.ts +49 -0
  25. package/dist/shared/assistant/ui/compact/windowWelcomeHooks.js +70 -0
  26. package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.d.ts +3 -1
  27. package/dist/shared/assistant/ui/composer/AssistantConnectSourceItem.js +27 -26
  28. package/dist/shared-assistant.js +29 -21
  29. package/package.json +2 -1
  30. package/src/shared/tokens/tokens.css +523 -0
@@ -0,0 +1,37 @@
1
+ import { useAssistantTr as e } from "../../i18n.js";
2
+ import { AudioLines as t, MessageSquareText as n, ShieldCheck as r, UserRound as i } from "lucide-react";
3
+ import { Fragment as a, jsx as o, jsxs as s } from "react/jsx-runtime";
4
+ // src/shared/assistant/ui/compact/AssistantWindowWelcomeTips.tsx
5
+ var c = {
6
+ ask: n,
7
+ change: r,
8
+ voice: t,
9
+ avatar: i
10
+ };
11
+ function l(e, t) {
12
+ return t === "ask" ? e("welcome.tipAsk", "Ask about anything on this page.") : t === "change" ? e("welcome.tipChange", "Ask for a change. It waits for your approval.") : t === "voice" ? e("welcome.tipVoice", "Press the voice button to talk.") : e("welcome.tipAvatar", "Switch to Avatar to talk with a video avatar.");
13
+ }
14
+ var u = ({ tips: t, source: n }) => {
15
+ let r = e();
16
+ return /* @__PURE__ */ s(a, { children: [/* @__PURE__ */ o("ul", {
17
+ className: "boff-welcome-tips",
18
+ children: t.map((e, t) => {
19
+ let n = c[e];
20
+ return /* @__PURE__ */ s("li", {
21
+ className: "boff-welcome-in",
22
+ "data-step": t + 1,
23
+ "data-testid": `assistant-welcome-tip-${e}`,
24
+ ...t > 0 ? { "data-welcome-fit": "" } : {},
25
+ children: [/* @__PURE__ */ o("span", {
26
+ className: "boff-welcome-dot",
27
+ "aria-hidden": "true",
28
+ children: /* @__PURE__ */ o(n, { className: "size-[0.8125rem]" })
29
+ }), /* @__PURE__ */ o("span", { children: l(r, e) })]
30
+ }, e);
31
+ })
32
+ }), n ? /* @__PURE__ */ o("ul", {
33
+ className: "boff-welcome-list",
34
+ children: n
35
+ }) : null] });
36
+ };
37
+ export { u as WelcomeTipsBody };
@@ -0,0 +1,15 @@
1
+ /**
2
+ * The window's name: "<Product> Assistant" (BOFF-15066), the product's display name from the shared catalog
3
+ * (`config/products.ts`), so every product gets its own name from the SDK with no app change.
4
+ *
5
+ * ★ Its own key, `window.productTitle`, never `window.title`: that one is seeded in every product as "Quick assistant", so
6
+ * reusing it would show the old words wherever a translation exists. A product the catalog does not know (a host's own id)
7
+ * keeps `window.title`: a wrong name is worse than the generic one.
8
+ */
9
+ export declare function useAssistantWindowTitle(): string;
10
+ /**
11
+ * Fit the window's name in its box: 15 px (no attribute), else 14 px (`data-tight`), else 13 px
12
+ * (`data-tighter`); a name that overflows even at 13 px keeps `data-tighter` and truncates. Each step is
13
+ * measured as it is set (the browser lays the heading out again on each read).
14
+ */
15
+ export declare function fitAssistantWindowTitle(heading: HTMLElement): void;
@@ -0,0 +1,13 @@
1
+ import { findProductConfig as e } from "../../../config/products.js";
2
+ import { useAssistantTr as t } from "../../i18n.js";
3
+ import { useAssistantProduct as n } from "../../product.js";
4
+ // src/shared/assistant/ui/compact/windowTitle.ts
5
+ function r() {
6
+ let r = t(), { product: i } = n(), a = i ? e(i)?.name : void 0;
7
+ return a ? r("window.productTitle", "{{product}} Assistant", { product: a }) : r("window.title", "Quick assistant");
8
+ }
9
+ function i(e) {
10
+ let t = () => e.scrollWidth > e.clientWidth;
11
+ e.removeAttribute("data-tight"), e.removeAttribute("data-tighter"), t() && (e.setAttribute("data-tight", ""), t() && (e.removeAttribute("data-tight"), e.setAttribute("data-tighter", "")));
12
+ }
13
+ export { i as fitAssistantWindowTitle, r as useAssistantWindowTitle };
@@ -0,0 +1,136 @@
1
+ import { AssistantIntent } from '../../autoRouting';
2
+ import { AssistantModeConfig } from '../../conversation';
3
+ import { AssistantMode } from '../../types';
4
+ /** The three expanding cards, in their order on screen. */
5
+ export type WelcomeCardKey = 'ask' | 'change' | 'tips';
6
+ /** One suggestion chip: the product's English, the mode its key is derived from, and (Auto only) where it routes. */
7
+ export interface WelcomeSuggestion {
8
+ readonly text: string;
9
+ /** The mode whose `suggestion.<mode>.<slug>` key translates it (`assistantSuggestionKey`). */
10
+ readonly sourceMode: AssistantMode;
11
+ /** Set only for an Auto chip, exactly as `AssistantEmptyState` sends it: which list it came from. */
12
+ readonly intent?: AssistantIntent;
13
+ }
14
+ /** What the Ask and Change cards hold. A card with nothing in it is `null`, and is not drawn. */
15
+ export interface WelcomeCards {
16
+ readonly ask: readonly WelcomeSuggestion[] | null;
17
+ readonly change: readonly WelcomeSuggestion[] | null;
18
+ /**
19
+ * Every change the Change card's mode makes waits for the person's approval. Only then may the
20
+ * welcome SAY so (the approval pill and the Tips line): a write mode without the brake must not be
21
+ * described as having one.
22
+ */
23
+ readonly waitsForApproval: boolean;
24
+ }
25
+ /**
26
+ * The Ask and Change cards for the active mode.
27
+ *
28
+ * ★ AUTO (`auto`: Auto is in effect and the conversation is still in its read mode, the chat area's
29
+ * own test): Ask holds the read mode's suggestions (`intent: 'read'`) and Change the write mode's
30
+ * (`intent: 'act'`), so a click is routed by the list it came from, never by its translated words,
31
+ * exactly as Auto's mixed chips were. A suggestion in both lists shows once, as the read mode's
32
+ * (`autoSuggestions`' rule).
33
+ *
34
+ * ★ A MODE THE PERSON CHOSE: one card, its own suggestions, no intent (the mode decides). A mode that
35
+ * writes (`writeCapable`) is the "Make a change" card, since its suggestions ask for changes; any
36
+ * other is the Ask card. The approval is said only where the mode holds every change for it
37
+ * (`modeRequiresConfirmWrites`, the sandbox's confirm-before-write).
38
+ */
39
+ export declare function welcomeCards(args: {
40
+ modes: readonly AssistantModeConfig[];
41
+ mode: AssistantMode;
42
+ auto: boolean;
43
+ }): WelcomeCards;
44
+ /** The Tips card's lines, each shown only where its feature is there. */
45
+ export type WelcomeTip = 'ask' | 'change' | 'voice' | 'avatar';
46
+ export declare function welcomeTips(args: {
47
+ /** The Change card shows AND its mode holds each change for approval. */
48
+ changeWaits: boolean;
49
+ /** The composer offers the voice conversation in this mode (its wave button). */
50
+ voiceOffered: boolean;
51
+ /** The Chat | Avatar switch is offered in this panel. */
52
+ avatarOffered: boolean;
53
+ }): WelcomeTip[];
54
+ /** The greeting's part of the day. */
55
+ export type WelcomeDayPart = 'morning' | 'afternoon' | 'evening';
56
+ /** The start page's rule: 05:00–11:59 morning, 12:00–17:59 afternoon, otherwise evening. */
57
+ export declare function welcomeDayPart(hour: number): WelcomeDayPart;
58
+ /** The parts of the signed-in user the greeting reads. */
59
+ export interface WelcomeUser {
60
+ readonly firstName?: string | null;
61
+ readonly name?: string | null;
62
+ }
63
+ /**
64
+ * The name the greeting uses: the first name, else the first word of the full name, else none.
65
+ * ★ Never the email: a profile whose name field holds an address (some sign-ups copy it there) is
66
+ * treated as having no name, and the greeting is just "Good evening".
67
+ */
68
+ export declare function welcomeFirstName(user: WelcomeUser | null | undefined): string | null;
69
+ /**
70
+ * Which header a key moves focus to, or null for a key the accordion does not use. Down and Up
71
+ * follow the order; Right and Left follow the screen, so they swap in a right-to-left panel. All
72
+ * of them wrap; Home and End go to the first and last.
73
+ */
74
+ export declare function welcomeHeaderTarget(key: string, index: number, count: number, rtl: boolean): number | null;
75
+ /** How long after its `pointerup` a gesture's record still counts (the mock's measured backstop). */
76
+ export declare const WELCOME_GESTURE_MS = 600;
77
+ /**
78
+ * The cards move while they slide, so a tap counts only on the card where the finger went DOWN
79
+ * (a fast second tap can land on a card that slid under it).
80
+ *
81
+ * ★ The record belongs to ONE gesture: any new pointerdown replaces it, any click or pointercancel
82
+ * clears it, and it goes stale `WELCOME_GESTURE_MS` after its pointerup, so it can never veto a
83
+ * later click that comes with no pointerdown of its own (assistive tech, voice control). A keyboard
84
+ * or programmatic click (`detail` 0) always counts.
85
+ */
86
+ export interface WelcomeGestureGuard {
87
+ /** A pointer went down: on this card's key, or `null` anywhere else. */
88
+ pointerDown(key: string | null): void;
89
+ pointerUp(): void;
90
+ /** The gesture ended without reaching a header (a chip tap, a cancel). */
91
+ clear(): void;
92
+ /** A header was clicked: does it count? Reads the record and ends the gesture. */
93
+ accepts(key: string, pointer: boolean): boolean;
94
+ }
95
+ export declare function createWelcomeGestureGuard(now: () => number): WelcomeGestureGuard;
96
+ /**
97
+ * Keep only the chips that fit in an open card's content box, so a card never scrolls inside
98
+ * itself: the optional rows (`data-welcome-fit`) are hidden from the last while the content
99
+ * overflows. Rows without the attribute always stay: the card's title, its FIRST chip or tip (the
100
+ * component leaves the attribute off it, so a card is never empty) and "Connect a source".
101
+ *
102
+ * ★ "Overflows" counts the box's END PADDING (`welcomeContentHeight`), not `scrollHeight`: a box that
103
+ * does not scroll leaves its end padding out of `scrollHeight`, so a chip could sit flush on the
104
+ * card's rounded bottom and still "fit" (BOFF-15066 review A11Y-1).
105
+ *
106
+ * ★ Measured on the card's FINAL layout: the content box is laid out at the open width even while
107
+ * the card is a strip (container units), so a closed card is fitted the same way and nothing
108
+ * reflows when it opens. Without layout (a server or a fake DOM: height 0) every row stays.
109
+ *
110
+ * `need` measures the content's height; the default is the real one, a test passes its own.
111
+ */
112
+ export declare function fitWelcomeList(inner: HTMLElement, need?: (inner: HTMLElement) => number): void;
113
+ /**
114
+ * The height an open card's content box needs as drawn now (after `fitWelcomeList`): from its top to the
115
+ * bottom of its lowest row, plus its end padding. Rows out of the flow (the screen-reader approval line)
116
+ * and rows the fit hid (no box) do not count. Without layout (a server or a fake DOM) it is 0.
117
+ */
118
+ export declare function welcomeContentHeight(inner: HTMLElement): number;
119
+ /** The row's bounds from its cards' content (`--bw-row-min` / `--bw-row-max`, in px; `null` leaves the stylesheet's). */
120
+ export interface WelcomeRowBounds {
121
+ readonly min: number | null;
122
+ readonly max: number | null;
123
+ }
124
+ /**
125
+ * ★ The cards are as tall as their tallest content, not the cap (BOFF-15066 review R2): a card with a
126
+ * title and one line must not stretch over 200 px of empty gradient. Every card counts, the closed ones
127
+ * too (their content is laid out at the open width), so opening another card never changes the row's
128
+ * height.
129
+ *
130
+ * ★ And never shorter than what a card must keep (review A11Y-1): when even the kept rows (the title,
131
+ * the first chip, "Connect a source") need more than the room, the row grows to them and the WELCOME
132
+ * scrolls, rather than a card clipping its own content.
133
+ *
134
+ * `needs` are `welcomeContentHeight`s; `rowHeight` the row's height before any bound was applied.
135
+ */
136
+ export declare function welcomeRowBounds(needs: readonly number[], rowHeight: number): WelcomeRowBounds;
@@ -0,0 +1,119 @@
1
+ import { modeRequiresConfirmWrites as e } from "../../api.js";
2
+ import { AUTO_READ_MODE as t, AUTO_WRITE_MODE as n } from "../../autoRouting.js";
3
+ import { resolveModeConfig as r } from "../../product.js";
4
+ // src/shared/assistant/ui/compact/windowWelcome.ts
5
+ var i = 4, a = (e) => e.length > 0 ? e : null;
6
+ function o(o) {
7
+ let { modes: s, mode: c, auto: l } = o;
8
+ if (l) {
9
+ let r = (s.find((e) => e.id === "assistant")?.suggestions ?? []).slice(0, i), o = new Set(r), c = (s.find((e) => e.id === "api-calls")?.suggestions ?? []).filter((e) => !o.has(e)).slice(0, i);
10
+ return {
11
+ ask: a(r.map((e) => ({
12
+ text: e,
13
+ sourceMode: t,
14
+ intent: "read"
15
+ }))),
16
+ change: a(c.map((e) => ({
17
+ text: e,
18
+ sourceMode: n,
19
+ intent: "act"
20
+ }))),
21
+ waitsForApproval: e(n)
22
+ };
23
+ }
24
+ let u = r(s, c), d = u?.id ?? c, f = a((u?.suggestions ?? []).slice(0, i).map((e) => ({
25
+ text: e,
26
+ sourceMode: d
27
+ })));
28
+ return u?.writeCapable ? {
29
+ ask: null,
30
+ change: f,
31
+ waitsForApproval: e(d)
32
+ } : {
33
+ ask: f,
34
+ change: null,
35
+ waitsForApproval: !1
36
+ };
37
+ }
38
+ function s(e) {
39
+ return [
40
+ "ask",
41
+ ...e.changeWaits ? ["change"] : [],
42
+ ...e.voiceOffered ? ["voice"] : [],
43
+ ...e.avatarOffered ? ["avatar"] : []
44
+ ];
45
+ }
46
+ function c(e) {
47
+ return e >= 5 && e < 12 ? "morning" : e >= 12 && e < 18 ? "afternoon" : "evening";
48
+ }
49
+ function l(e) {
50
+ let t = [e?.firstName?.trim(), e?.name?.trim().split(/\s+/)[0]];
51
+ for (let e of t) if (e && !e.includes("@")) return e;
52
+ return null;
53
+ }
54
+ function u(e, t, n, r) {
55
+ return e === "ArrowDown" || e === (r ? "ArrowLeft" : "ArrowRight") ? (t + 1) % n : e === "ArrowUp" || e === (r ? "ArrowRight" : "ArrowLeft") ? (t - 1 + n) % n : e === "Home" ? 0 : e === "End" ? n - 1 : null;
56
+ }
57
+ var d = 600;
58
+ function f(e) {
59
+ let t = null;
60
+ return {
61
+ pointerDown(n) {
62
+ t = n === null ? null : {
63
+ key: n,
64
+ at: e()
65
+ };
66
+ },
67
+ pointerUp() {
68
+ t &&= {
69
+ key: t.key,
70
+ at: e()
71
+ };
72
+ },
73
+ clear() {
74
+ t = null;
75
+ },
76
+ accepts(n, r) {
77
+ let i = t;
78
+ t = null;
79
+ let a = i !== null && e() - i.at < 600;
80
+ return !(r && a && i.key !== n);
81
+ }
82
+ };
83
+ }
84
+ function p(e, t = m) {
85
+ let n = Array.from(e.querySelectorAll("[data-welcome-fit]"));
86
+ for (let e of n) e.hidden = !1;
87
+ if (e.clientHeight !== 0) for (let r = n.length - 1; r >= 0; --r) {
88
+ if (t(e) <= e.clientHeight + .5) return;
89
+ let i = n[r];
90
+ i && (i.hidden = !0);
91
+ }
92
+ }
93
+ function m(e) {
94
+ if (e.clientHeight === 0) return 0;
95
+ let t = e.getBoundingClientRect().top, n = t;
96
+ for (let t of Array.from(e.children)) {
97
+ if (getComputedStyle(t).position === "absolute") continue;
98
+ let e = t.getBoundingClientRect();
99
+ e.height > 0 && (n = Math.max(n, e.bottom));
100
+ }
101
+ let r = parseFloat(getComputedStyle(e).paddingBlockEnd);
102
+ return n - t + (Number.isFinite(r) ? r : 0);
103
+ }
104
+ function h(e, t) {
105
+ let n = Math.max(0, ...e);
106
+ if (t <= 0 || n <= 0) return {
107
+ min: null,
108
+ max: null
109
+ };
110
+ let r = Math.ceil(n);
111
+ return n > t + .5 ? {
112
+ min: r,
113
+ max: null
114
+ } : {
115
+ min: null,
116
+ max: r
117
+ };
118
+ }
119
+ export { d as WELCOME_GESTURE_MS, f as createWelcomeGestureGuard, p as fitWelcomeList, o as welcomeCards, m as welcomeContentHeight, c as welcomeDayPart, l as welcomeFirstName, u as welcomeHeaderTarget, h as welcomeRowBounds, s as welcomeTips };
@@ -0,0 +1,49 @@
1
+ import { KeyboardEvent, MouseEvent, RefObject } from 'react';
2
+ import { AssistantTr } from '../../i18n';
3
+ import { WelcomeCardKey, WelcomeCards, WelcomeGestureGuard, WelcomeTip } from './windowWelcome';
4
+ /**
5
+ * ★ One gesture's pointer record (`createWelcomeGestureGuard`). Listened for on the window, as the
6
+ * mock measured it: capture for the down/up/cancel (before any card handles them), bubble for the
7
+ * click that ends the gesture (after the header's own handler has read the record).
8
+ */
9
+ export declare function useWelcomeGestureGuard(rowRef: RefObject<HTMLDivElement | null>): WelcomeGestureGuard;
10
+ /** The accordion's state and wiring, for the cards in `keys` (in their order on screen). */
11
+ export interface WelcomeAccordion {
12
+ /** The open card: the one picked while it is drawn, else the first. */
13
+ readonly open: WelcomeCardKey;
14
+ /** Only one card is drawn: no accordion, just its list. */
15
+ readonly single: boolean;
16
+ readonly headId: (key: WelcomeCardKey) => string;
17
+ readonly panelId: (key: WelcomeCardKey) => string;
18
+ /** A header button's ref, so the arrow keys can move focus to it. */
19
+ readonly setHead: (key: WelcomeCardKey, node: HTMLButtonElement | null) => void;
20
+ readonly onHeadClick: (key: WelcomeCardKey) => (event: MouseEvent<HTMLButtonElement>) => void;
21
+ readonly onHeadKeyDown: (index: number) => (event: KeyboardEvent<HTMLButtonElement>) => void;
22
+ }
23
+ /**
24
+ * ★ APG ACCORDION, horizontal: one card is always open; a header click opens its card unless the
25
+ * gesture guard turns it down; Arrows, Home and End move between headers (Enter and Space are the
26
+ * button's own).
27
+ */
28
+ export declare function useWelcomeAccordion(keys: readonly WelcomeCardKey[], guard: WelcomeGestureGuard): WelcomeAccordion;
29
+ /** What the fit reads: everything that changes what the cards DRAW. */
30
+ export interface WelcomeFitInput {
31
+ readonly rowRef: RefObject<HTMLDivElement | null>;
32
+ readonly welcomeRef: RefObject<HTMLDivElement | null>;
33
+ readonly keys: readonly WelcomeCardKey[];
34
+ readonly cards: WelcomeCards;
35
+ readonly tips: readonly WelcomeTip[];
36
+ readonly canConnectSource: boolean;
37
+ readonly page: string | null;
38
+ readonly tr: AssistantTr;
39
+ }
40
+ /**
41
+ * ★ Each card keeps only the chips that fit (no card scrolls inside itself), and the row is as tall as its tallest
42
+ * content (`welcomeRowBounds`). Re-run whenever what is DRAWN changes: the card set, every chip's words (a mode switch
43
+ * between two Ask-card modes changes only those: BOFF-15066 review R1), the tips and "Connect a source"; and again
44
+ * whenever the welcome (the panel) or a card's box resizes. Each pass first lifts the row's bounds, so a taller panel
45
+ * gets its chips back.
46
+ *
47
+ * Returns the ref each card's content box registers with.
48
+ */
49
+ export declare function useWelcomeFit({ rowRef, welcomeRef, keys, cards, tips, canConnectSource, page, tr, }: WelcomeFitInput): (key: WelcomeCardKey, node: HTMLDivElement | null) => void;
@@ -0,0 +1,70 @@
1
+ import { createWelcomeGestureGuard as e, fitWelcomeList as t, welcomeContentHeight as n, welcomeHeaderTarget as r, welcomeRowBounds as i } from "./windowWelcome.js";
2
+ import { useEffect as a, useId as o, useLayoutEffect as s, useRef as c, useState as l } from "react";
3
+ // src/shared/assistant/ui/compact/windowWelcomeHooks.ts
4
+ function u(t) {
5
+ let [n] = l(() => e(() => performance.now()));
6
+ return a(() => {
7
+ let e = (e) => {
8
+ let n = t.current;
9
+ return !n || typeof Element > "u" || !(e instanceof Element) || !n.contains(e) ? null : e.closest("[data-welcome-card]")?.getAttribute("data-welcome-card") ?? null;
10
+ }, r = (t) => n.pointerDown(e(t.target)), i = () => n.pointerUp(), a = () => n.clear();
11
+ return window.addEventListener("pointerdown", r, !0), window.addEventListener("pointerup", i, !0), window.addEventListener("pointercancel", a, !0), window.addEventListener("click", a), () => {
12
+ window.removeEventListener("pointerdown", r, !0), window.removeEventListener("pointerup", i, !0), window.removeEventListener("pointercancel", a, !0), window.removeEventListener("click", a);
13
+ };
14
+ }, [n, t]), n;
15
+ }
16
+ function d(e, t) {
17
+ let n = e[0] ?? "tips", [i, a] = l(n), s = o(), u = c({});
18
+ return {
19
+ open: e.includes(i) ? i : n,
20
+ single: e.length === 1,
21
+ headId: (e) => `${s}-head-${e}`,
22
+ panelId: (e) => `${s}-panel-${e}`,
23
+ setHead: (e, t) => {
24
+ u.current[e] = t;
25
+ },
26
+ onHeadClick: (e) => (n) => {
27
+ t.accepts(e, n.detail > 0) && a(e);
28
+ },
29
+ onHeadKeyDown: (t) => (n) => {
30
+ let i = getComputedStyle(n.currentTarget).direction === "rtl", a = r(n.key, t, e.length, i);
31
+ if (a === null) return;
32
+ n.preventDefault();
33
+ let o = e[a];
34
+ o && u.current[o]?.focus();
35
+ }
36
+ };
37
+ }
38
+ function f({ rowRef: e, welcomeRef: r, keys: a, cards: o, tips: l, canConnectSource: u, page: d, tr: f }) {
39
+ let p = c({}), m = [
40
+ a.join(),
41
+ ...(o.ask ?? []).map((e) => e.text),
42
+ ...(o.change ?? []).map((e) => e.text),
43
+ l.join(),
44
+ String(u)
45
+ ].join("");
46
+ return s(() => {
47
+ let a = e.current, o = r.current;
48
+ if (!a || !o) return;
49
+ let s = Object.values(p.current).filter((e) => e != null), c = () => {
50
+ a.style.removeProperty("--bw-row-min"), a.style.removeProperty("--bw-row-max");
51
+ for (let e of s) t(e);
52
+ let e = i(s.map(n), a.clientHeight);
53
+ e.min !== null && a.style.setProperty("--bw-row-min", `${e.min}px`), e.max !== null && a.style.setProperty("--bw-row-max", `${e.max}px`);
54
+ };
55
+ if (c(), typeof ResizeObserver > "u") return;
56
+ let l = new ResizeObserver(c);
57
+ l.observe(o);
58
+ for (let e of s) l.observe(e);
59
+ return () => l.disconnect();
60
+ }, [
61
+ m,
62
+ d,
63
+ f,
64
+ e,
65
+ r
66
+ ]), (e, t) => {
67
+ p.current[e] = t;
68
+ };
69
+ }
70
+ export { d as useWelcomeAccordion, f as useWelcomeFit, u as useWelcomeGestureGuard };
@@ -22,13 +22,15 @@ export declare function connectSourceActivation(open: () => void, onActivate?: (
22
22
  * - `action`: a standalone, visibly labelled button, for the empty
23
23
  * conversation (BOFF-8158). Not a `menuitem`, because there is no menu
24
24
  * around it, and a role that promises one misleads a screen reader.
25
+ * - `card`: the same labelled entry as a row of the compact welcome's open card
26
+ * (BOFF-15066), drawn like the card's chips so it belongs to the card.
25
27
  *
26
28
  * ★★ ONE COMPONENT FOR BOTH, not a second copy. Everything that decides
27
29
  * whether the entry exists and what a click does (the shared availability
28
30
  * predicate, a product's own `open` winning over its href, the router getting
29
31
  * the resolved path, the browser winning a modified click) lives here once.
30
32
  */
31
- export type AssistantConnectSourcePresentation = 'menuitem' | 'action';
33
+ export type AssistantConnectSourcePresentation = 'menuitem' | 'action' | 'card';
32
34
  export interface AssistantConnectSourceItemProps {
33
35
  /** Close the surrounding menu. Fired only when this item actually acts. */
34
36
  onActivate?: () => void;
@@ -11,41 +11,42 @@ function u(e, t) {
11
11
  t?.(), e();
12
12
  };
13
13
  }
14
- var d = "flex w-full items-center gap-2.5 border-t border-border-subtle px-3 py-2 text-start text-sm text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:bg-bg-sunken", f = "inline-flex items-center gap-2 rounded-lg border border-border-default bg-bg-surface px-3.5 py-2 text-[13px] font-medium leading-tight text-text-primary shadow-sm transition-[color,background-color,border-color] hover:border-action-primary-bg/40 hover:bg-bg-elevated focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong", p = {
14
+ var d = "flex w-full items-center gap-2.5 border-t border-border-subtle px-3 py-2 text-start text-sm text-text-primary transition-colors hover:bg-bg-sunken focus:outline-none focus-visible:bg-bg-sunken", f = "inline-flex items-center gap-2 rounded-lg border border-border-default bg-bg-surface px-3.5 py-2 text-[13px] font-medium leading-tight text-text-primary shadow-sm transition-[color,background-color,border-color] hover:border-action-primary-bg/40 hover:bg-bg-elevated focus:outline-none focus-visible:ring-2 focus-visible:ring-border-strong", p = "boff-welcome-chip boff-welcome-source boff-gloss-card", m = {
15
15
  menuitem: "assistant-connect-source",
16
- action: "assistant-connect-source-action"
17
- }, m = ({ onActivate: m, presentation: h = "menuitem" }) => {
18
- let g = n(), { href: _, open: v } = a(), y = r(), b = t(_), x = b === "internal" ? e(_) : null, S = o((e) => {
19
- e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || (m?.(), y && x && (e.preventDefault(), Promise.resolve(y(x, "person", { surface: "connect-source" })).catch(() => void 0)));
16
+ action: "assistant-connect-source-action",
17
+ card: "assistant-connect-source-action"
18
+ }, h = ({ onActivate: h, presentation: g = "menuitem" }) => {
19
+ let _ = n(), { href: v, open: y } = a(), b = r(), x = t(v), S = x === "internal" ? e(v) : null, C = o((e) => {
20
+ e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.shiftKey || e.altKey || (h?.(), b && S && (e.preventDefault(), Promise.resolve(b(S, "person", { surface: "connect-source" })).catch(() => void 0)));
20
21
  }, [
21
- y,
22
- x,
23
- m
24
- ]), C = g("composer.connectSource", "Connect a source"), w = h === "menuitem", T = w ? "menuitem" : void 0, E = w ? d : f, D = w ? "size-4 flex-shrink-0 text-text-secondary" : "size-4 flex-shrink-0 text-action-primary-bg", O = p[h];
25
- return v ? /* @__PURE__ */ l("button", {
22
+ b,
23
+ S,
24
+ h
25
+ ]), w = _("composer.connectSource", "Connect a source"), T = g === "menuitem", E = T ? "menuitem" : void 0, D = g === "card" ? p : T ? d : f, O = g === "card" ? "boff-welcome-source-icon" : T ? "size-4 flex-shrink-0 text-text-secondary" : "size-4 flex-shrink-0 text-action-primary-bg", k = m[g];
26
+ return y ? /* @__PURE__ */ l("button", {
26
27
  type: "button",
27
- role: T,
28
- onClick: u(v, m),
29
- className: E,
30
- "data-testid": O,
28
+ role: E,
29
+ onClick: u(y, h),
30
+ className: D,
31
+ "data-testid": k,
31
32
  children: [/* @__PURE__ */ c(s, {
32
- className: D,
33
+ className: O,
33
34
  "aria-hidden": "true"
34
- }), C]
35
- }) : i(_) ? /* @__PURE__ */ l("a", {
36
- href: _,
37
- role: T,
38
- onClick: S,
39
- ...b === "external" ? {
35
+ }), w]
36
+ }) : i(v) ? /* @__PURE__ */ l("a", {
37
+ href: v,
38
+ role: E,
39
+ onClick: C,
40
+ ...x === "external" ? {
40
41
  target: "_blank",
41
42
  rel: "noopener noreferrer"
42
43
  } : {},
43
- className: E,
44
- "data-testid": O,
44
+ className: D,
45
+ "data-testid": k,
45
46
  children: [/* @__PURE__ */ c(s, {
46
- className: D,
47
+ className: O,
47
48
  "aria-hidden": "true"
48
- }), C]
49
+ }), w]
49
50
  }) : null;
50
51
  };
51
- export { m as AssistantConnectSourceItem, u as connectSourceActivation };
52
+ export { h as AssistantConnectSourceItem, u as connectSourceActivation };