oneslash-design-system 2.23.0 → 2.24.0

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 (81) hide show
  1. package/README.md +1 -1
  2. package/dist/DESIGN.md +13 -2
  3. package/dist/cases/activity-timeline/activity.d.ts +1 -0
  4. package/dist/cases/activity-timeline/activity.jsx +43 -0
  5. package/dist/cases/activity-timeline/versions.d.ts +1 -0
  6. package/dist/cases/activity-timeline/versions.jsx +130 -0
  7. package/dist/cases/activity-timeline.md +315 -0
  8. package/dist/cases/agent-plan-proposal.md +1 -0
  9. package/dist/cases/ask-page/answered.d.ts +1 -0
  10. package/dist/cases/ask-page/answered.jsx +240 -0
  11. package/dist/cases/ask-page/first-visit.d.ts +1 -0
  12. package/dist/cases/ask-page/first-visit.jsx +118 -0
  13. package/dist/cases/ask-page.md +542 -0
  14. package/dist/cases/chart/bars.d.ts +1 -0
  15. package/dist/cases/chart/bars.jsx +83 -0
  16. package/dist/cases/chart/lines.d.ts +1 -0
  17. package/dist/cases/chart/lines.jsx +71 -0
  18. package/dist/cases/chart.md +258 -0
  19. package/dist/cases/comment-thread/card.d.ts +1 -0
  20. package/dist/cases/comment-thread/card.jsx +141 -0
  21. package/dist/cases/comment-thread/thread.d.ts +1 -0
  22. package/dist/cases/comment-thread/thread.jsx +87 -0
  23. package/dist/cases/comment-thread.md +349 -0
  24. package/dist/cases/dashboard/numbers-first.jsx +62 -1
  25. package/dist/cases/dashboard.md +75 -3
  26. package/dist/cases/leaderboard/ranked.d.ts +1 -0
  27. package/dist/cases/leaderboard/ranked.jsx +44 -0
  28. package/dist/cases/leaderboard/table.d.ts +1 -0
  29. package/dist/cases/leaderboard/table.jsx +87 -0
  30. package/dist/cases/leaderboard.md +177 -0
  31. package/dist/cases/number-format.md +4 -2
  32. package/dist/cases/onboarding/checklist.d.ts +1 -0
  33. package/dist/cases/onboarding/checklist.jsx +92 -0
  34. package/dist/cases/onboarding/steps.d.ts +3 -0
  35. package/dist/cases/onboarding/steps.jsx +177 -0
  36. package/dist/cases/onboarding.md +368 -0
  37. package/dist/cases/plan-sign-off/one-approver.d.ts +1 -0
  38. package/dist/cases/plan-sign-off/one-approver.jsx +129 -0
  39. package/dist/cases/plan-sign-off/team.d.ts +1 -0
  40. package/dist/cases/plan-sign-off/team.jsx +213 -0
  41. package/dist/cases/plan-sign-off.md +541 -0
  42. package/dist/cases/stat-row.md +1 -1
  43. package/dist/cases/task-header/agent-sets-status.d.ts +1 -0
  44. package/dist/cases/task-header/agent-sets-status.jsx +164 -0
  45. package/dist/cases/task-header/people-change-status.d.ts +1 -0
  46. package/dist/cases/task-header/people-change-status.jsx +175 -0
  47. package/dist/cases/task-header.md +576 -0
  48. package/dist/cases.json +645 -7
  49. package/dist/components/barChart.d.ts +35 -0
  50. package/dist/components/barChart.jsx +90 -0
  51. package/dist/components/heading.d.ts +2 -2
  52. package/dist/components/heading.jsx +5 -3
  53. package/dist/components/lineChart.d.ts +39 -0
  54. package/dist/components/lineChart.jsx +128 -0
  55. package/dist/components/popover.jsx +7 -2
  56. package/dist/components/timeline.d.ts +32 -0
  57. package/dist/components/timeline.jsx +54 -0
  58. package/dist/components/titleBar.d.ts +3 -1
  59. package/dist/components/titleBar.jsx +9 -4
  60. package/dist/internal/chart.d.ts +39 -0
  61. package/dist/internal/chart.js +110 -0
  62. package/dist/internal/chartFrame.d.ts +29 -0
  63. package/dist/internal/chartFrame.jsx +57 -0
  64. package/dist/native-mapping.json +19 -1
  65. package/dist/stories/BarChart.stories.d.ts +10 -0
  66. package/dist/stories/BarChart.stories.jsx +104 -0
  67. package/dist/stories/Cases.generated.stories.d.ts +16 -0
  68. package/dist/stories/Cases.generated.stories.jsx +32 -0
  69. package/dist/stories/Heading.stories.d.ts +1 -0
  70. package/dist/stories/Heading.stories.jsx +17 -0
  71. package/dist/stories/LineChart.stories.d.ts +9 -0
  72. package/dist/stories/LineChart.stories.jsx +34 -0
  73. package/dist/stories/Onboarding.probe.stories.d.ts +6 -0
  74. package/dist/stories/Onboarding.probe.stories.jsx +12 -0
  75. package/dist/stories/Popover.stories.d.ts +1 -0
  76. package/dist/stories/Popover.stories.jsx +17 -0
  77. package/dist/stories/Timeline.stories.d.ts +8 -0
  78. package/dist/stories/Timeline.stories.jsx +49 -0
  79. package/dist/stories/TitleBar.stories.d.ts +1 -0
  80. package/dist/stories/TitleBar.stories.jsx +13 -0
  81. package/package.json +1 -1
@@ -0,0 +1,240 @@
1
+ 'use client';
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
14
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
15
+ if (ar || !(i in from)) {
16
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
17
+ ar[i] = from[i];
18
+ }
19
+ }
20
+ return to.concat(ar || Array.prototype.slice.call(from));
21
+ };
22
+ import { useEffect, useRef, useState } from 'react';
23
+ import { BookOpen, Bot, ListChecks, MessageSquare, Plug } from 'lucide-react';
24
+ import Toaster, { toast, dismissToast } from '../../components/toaster';
25
+ import AppShell from '../../components/appShell';
26
+ import Navigation from '../../components/navigation';
27
+ import MenuItem from '../../components/menuItem';
28
+ import TitleBar from '../../components/titleBar';
29
+ import Button from '../../components/button';
30
+ import Popover from '../../components/popover';
31
+ import Menu from '../../components/menu';
32
+ import Line from '../../components/line';
33
+ import Message from '../../components/message';
34
+ import UserImage from '../../components/userImage';
35
+ import TimeStamp from '../../components/timeStamp';
36
+ import Tag from '../../components/tag';
37
+ import Paragraph from '../../components/paragraph';
38
+ import SourceCard from '../../components/sourceCard';
39
+ import Composer from '../../components/composer';
40
+ import StepList from '../../components/stepList';
41
+ import { Cluster, Grid, Stack } from '../../components/layout';
42
+ // A real app reads these from the session.
43
+ var me = 'Dana Lee';
44
+ var agentName = 'Acme Agent';
45
+ var workspaces = ['Acme Design', 'Acme Engineering', 'Acme Marketing'];
46
+ var all = "All ".concat(workspaces.length, " Workspaces");
47
+ var question = { from: me, at: new Date('2026-11-16T14:40:00Z'), text: 'Who owns the press kit for the launch?' };
48
+ var answeredAt = new Date('2026-11-16T14:41:00Z');
49
+ var answer = 'Mia Park owns the press kit. Ben Carter handed it to her in #launch on Nov 12, 2026, and the launch plan lists her as its owner. It is due Nov 19, 2026.';
50
+ var kinds = {
51
+ chat: { label: 'Chat', icon: MessageSquare },
52
+ docs: { label: 'Docs', icon: BookOpen },
53
+ tasks: { label: 'Tasks', icon: ListChecks },
54
+ };
55
+ // Each card links to the thing it read.
56
+ var sources = [
57
+ { kind: 'chat', title: 'Press kit hand-off', where: 'Acme Marketing · #launch · Nov 12', href: '/chat/launch/m-2210' },
58
+ { kind: 'docs', title: 'Launch plan', where: 'Acme Marketing', href: '/docs/launch-plan' },
59
+ { kind: 'tasks', title: 'Write the press kit', where: 'Acme Design · Due Nov 19', href: '/tasks/press-kit' },
60
+ ];
61
+ // 'From Chat · Docs · Tasks': each kind once, in the order it first appears.
62
+ var kindsTag = "From ".concat(sources.map(function (s) { return kinds[s.kind].label; }).filter(function (l, i, list) { return list.indexOf(l) === i; }).join(' · '));
63
+ // The places. A real app lets each link go to its page.
64
+ var sidebar = (<Navigation aria-label="Main">
65
+ {[
66
+ ['Home', 'House', '/'],
67
+ ['Ask', 'MessageCircle', '/ask'],
68
+ ['Docs', 'BookOpen', '/docs'],
69
+ ].map(function (_a) {
70
+ var label = _a[0], icon = _a[1], href = _a[2];
71
+ return (<MenuItem key={href} size="small" label={label} iconName={icon} href={href} isSelected={href === '/ask'} aria-current={href === '/ask' ? 'page' : undefined} onClick={function (event) { return event.preventDefault(); }}/>);
72
+ })}
73
+ </Navigation>);
74
+ export default function AskPageAnswered() {
75
+ var _a = useState(false), navOpen = _a[0], setNavOpen = _a[1];
76
+ // null means every workspace.
77
+ var _b = useState(null), scope = _b[0], setScope = _b[1];
78
+ var _c = useState(null), anchor = _c[0], setAnchor = _c[1];
79
+ var _d = useState(false), open = _d[0], setOpen = _d[1];
80
+ var _e = useState([]), turns = _e[0], setTurns = _e[1];
81
+ var _f = useState(''), text = _f[0], setText = _f[1];
82
+ var _g = useState(false), saving = _g[0], setSaving = _g[1];
83
+ var _h = useState(false), saved = _h[0], setSaved = _h[1];
84
+ var openButton = useRef(null);
85
+ var timer = useRef();
86
+ var run = useRef();
87
+ var tick = useRef();
88
+ var field = useRef(null);
89
+ var toastIds = useRef([]);
90
+ // Where focus goes after the next render, once the element it goes to is on screen.
91
+ var focusNext = useRef();
92
+ var label = scope !== null && scope !== void 0 ? scope : all;
93
+ // On unmount it stops the request and closes every toast it opened.
94
+ useEffect(function () { return function () {
95
+ clearTimeout(timer.current);
96
+ clearTimeout(run.current);
97
+ clearInterval(tick.current);
98
+ toastIds.current.forEach(function (id) { return dismissToast(id); });
99
+ toastIds.current = [];
100
+ }; }, []);
101
+ useEffect(function () {
102
+ var move = focusNext.current;
103
+ focusNext.current = undefined;
104
+ move === null || move === void 0 ? void 0 : move();
105
+ });
106
+ function choose(next) {
107
+ setScope(next);
108
+ setOpen(false);
109
+ }
110
+ // The answer goes to Docs, away from this page, so a toast says where it went.
111
+ // 'Save to Docs' gives way to a link to the new doc, and focus goes to it.
112
+ function saveToDocs() {
113
+ if (saving || saved)
114
+ return;
115
+ setSaving(true);
116
+ // Stands in for the request to the server.
117
+ timer.current = setTimeout(function () {
118
+ setSaving(false);
119
+ setSaved(true);
120
+ toastIds.current.push(toast({ type: 'success', message: 'Answer saved to Docs.' }));
121
+ focusNext.current = function () { var _a; return (_a = openButton.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); };
122
+ }, 1200);
123
+ }
124
+ var running = turns.some(function (t) { return t.phase === 'running' || t.phase === 'stopping'; });
125
+ // Changes the last turn, the one the agent is working on.
126
+ function setLast(change) {
127
+ setTurns(function (list) { return list.map(function (t, i) { return (i === list.length - 1 ? __assign(__assign({}, t), change) : t); }); });
128
+ }
129
+ function endRun() {
130
+ clearTimeout(run.current);
131
+ clearInterval(tick.current);
132
+ }
133
+ // The question shows at once, and the agent's progress row takes the place of its answer while it works.
134
+ // This run finds nothing in the scope, so its answer says so in one plain sentence and shows no sources.
135
+ function send() {
136
+ if (running)
137
+ return;
138
+ setTurns(function (list) { return __spreadArray(__spreadArray([], list, true), [{ id: "t".concat(list.length + 1), text: text.trim(), scope: scope, phase: 'running', seconds: 0 }], false); });
139
+ setText('');
140
+ tick.current = setInterval(function () { return setTurns(function (list) { return list.map(function (t, i) { return (i === list.length - 1 ? __assign(__assign({}, t), { seconds: t.seconds + 1 }) : t); }); }); }, 1000);
141
+ // Stands in for the agent's run.
142
+ run.current = setTimeout(function () {
143
+ endRun();
144
+ setLast({ phase: 'nothing' });
145
+ }, 3000);
146
+ }
147
+ // Stop asks the server to end the run. The row says it stopped only once the run has ended,
148
+ // then focus goes back to the question box, since Stop is gone.
149
+ function stop() {
150
+ clearTimeout(run.current);
151
+ setLast({ phase: 'stopping' });
152
+ run.current = setTimeout(function () {
153
+ endRun();
154
+ setLast({ phase: 'stopped' });
155
+ focusNext.current = function () { var _a; return (_a = field.current) === null || _a === void 0 ? void 0 : _a.focus({ preventScroll: true }); };
156
+ }, 1200);
157
+ }
158
+ return (<AppShell title="Ask" navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar}>
159
+ <Stack gap="large">
160
+ <TitleBar title="Ask" actions={
161
+ // The label is the scope. The chevron says it opens a menu.
162
+ <Button size="small" type="tertiary" state={open ? 'selected' : 'enabled'} label={label} actionIcon="ChevronDown" aria-label={"".concat(label, ", change where ").concat(agentName, " looks")} aria-haspopup="menu" aria-expanded={open} onClickButton={function (e) {
163
+ setAnchor(e.currentTarget);
164
+ setOpen(function (o) { return !o; });
165
+ }}/>}/>
166
+ {/* A real app keeps the conversation when the person leaves, and gives the list that holds the rows role="log". */}
167
+ <Stack gap="small">
168
+ <Message aria-label={question.from} avatar={<UserImage userHandle={question.from} decorative/>} name={question.from} meta={<TimeStamp createdAt={question.at} dateFormat="absolute" data="time"/>}>
169
+ <Paragraph measure="none">{question.text}</Paragraph>
170
+ </Message>
171
+ <Message aria-label={"".concat(agentName, ", agent")} avatar={<UserImage userHandle={agentName} icon={Bot} decorative/>} name={agentName} meta={<>
172
+ <Tag variant="contained" size="small" label="Agent"/>
173
+ <TimeStamp createdAt={answeredAt} dateFormat="absolute" data="time"/>
174
+ <Paragraph size="caption" tone="secondary" measure="none">Model name</Paragraph>
175
+ </>}
176
+ // The sources sit directly under the answer they support.
177
+ footer={<Stack gap="medium">
178
+ <Cluster>
179
+ <Tag variant="contained" size="small" color="success" icon={Plug} label={kindsTag}/>
180
+ </Cluster>
181
+ <Grid columns={2} gap="medium">
182
+ {sources.map(function (s) { return (<SourceCard key={s.href} icon={kinds[s.kind].icon} title={s.title} meta={"".concat(kinds[s.kind].label, " \u00B7 ").concat(s.where)} href={s.href}/>); })}
183
+ </Grid>
184
+ <Cluster>
185
+ {saved ? (<Button ref={openButton} size="small" type="tertiary" state="enabled" label="Open in Docs" decoIcon="FileText" href="/docs/press-kit-owner"/>) : (<Button size="small" type="secondary" state="enabled" label="Save to Docs" decoIcon="BookmarkPlus" loading={saving} onClickButton={saveToDocs}/>)}
186
+ </Cluster>
187
+ </Stack>}>
188
+ <Paragraph measure="none">{answer}</Paragraph>
189
+ </Message>
190
+ {turns.map(function (t) {
191
+ var _a;
192
+ var place = (_a = t.scope) !== null && _a !== void 0 ? _a : "all ".concat(workspaces.length, " of your workspaces");
193
+ var working = t.phase === 'running' || t.phase === 'stopping';
194
+ return (<Stack key={t.id} gap="small">
195
+ <Message aria-label={me} avatar={<UserImage userHandle={me} decorative/>} name={me} meta={<TimeStamp createdAt={new Date('2026-11-16T14:45:00Z')} dateFormat="absolute" data="time"/>}>
196
+ <Paragraph measure="none">{t.text}</Paragraph>
197
+ </Message>
198
+ <Message aria-label={"".concat(agentName, ", agent")} avatar={<UserImage userHandle={agentName} icon={Bot} decorative/>} name={agentName} meta={<>
199
+ <Tag variant="contained" size="small" label="Agent"/>
200
+ <TimeStamp createdAt={new Date('2026-11-16T14:45:00Z')} dateFormat="absolute" data="time"/>
201
+ <Paragraph size="caption" tone="secondary" measure="none">Model name</Paragraph>
202
+ </>}
203
+ // The only Stop, on the row for the whole run. It shows loading while the run is stopping.
204
+ footer={working ? (<Cluster>
205
+ <Button size="small" type="secondary" state="enabled" label="Stop" loading={t.phase === 'stopping'} onClickButton={stop}/>
206
+ </Cluster>) : undefined}>
207
+ {working ? (
208
+ // A real app wraps this part in a polite live region, since StepList has none.
209
+ <Stack gap="medium">
210
+ <Paragraph size="caption" tone="secondary" measure="none">{"Working for ".concat(t.seconds, " ").concat(t.seconds === 1 ? 'second' : 'seconds')}</Paragraph>
211
+ <StepList aria-label={"".concat(agentName, "'s steps")} steps={[
212
+ { label: 'Read your question', status: 'done' },
213
+ { label: "Looking in the docs, chats and tasks of ".concat(place), status: 'running' },
214
+ ]}/>
215
+ </Stack>) : t.phase === 'stopped' ? (<Paragraph measure="none">Stopped. Nothing was changed.</Paragraph>) : (
216
+ // It read nothing it could use, so the answer has no sources section.
217
+ <Paragraph measure="none">{"I found nothing about this in the docs, chats and tasks of ".concat(place, ". Try other words, or change where I look.")}</Paragraph>)}
218
+ </Message>
219
+ </Stack>);
220
+ })}
221
+ </Stack>
222
+ <Stack gap="small">
223
+ {/* Where the agent looks, said above the box it is asked in. */}
224
+ <Paragraph size="body2" tone="secondary" measure="none">
225
+ {scope ? "".concat(agentName, " looks in the docs, chats and tasks of ").concat(scope, ".") : "".concat(agentName, " looks in the docs, chats and tasks of all ").concat(workspaces.length, " of your workspaces.")}
226
+ </Paragraph>
227
+ <Composer ref={field} id="ask-page-answered-question" aria-label={"Ask ".concat(agentName)} placeholder={"Ask ".concat(agentName)} value={text} onChange={setText} onSubmit={send}/>
228
+ </Stack>
229
+ </Stack>
230
+ <Popover open={open} anchorEl={anchor} onClose={function () { return setOpen(false); }} returnFocus>
231
+ <Menu navigable aria-label={"Where ".concat(agentName, " looks")} width={220}>
232
+ <MenuItem size="small" label={all} isSelected={scope === null} role="menuitemradio" onClick={function () { return choose(null); }}/>
233
+ <Line />
234
+ {workspaces.map(function (w) { return (<MenuItem key={w} size="small" label={w} isSelected={scope === w} role="menuitemradio" onClick={function () { return choose(w); }}/>); })}
235
+ </Menu>
236
+ </Popover>
237
+ {/* A real app mounts one Toaster near its root. */}
238
+ <Toaster />
239
+ </AppShell>);
240
+ }
@@ -0,0 +1 @@
1
+ export default function AskPageFirstVisit(): import("react").JSX.Element;
@@ -0,0 +1,118 @@
1
+ 'use client';
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ import { useEffect, useRef, useState } from 'react';
12
+ import AppShell from '../../components/appShell';
13
+ import Navigation from '../../components/navigation';
14
+ import MenuItem from '../../components/menuItem';
15
+ import TitleBar from '../../components/titleBar';
16
+ import Button from '../../components/button';
17
+ import Popover from '../../components/popover';
18
+ import Menu from '../../components/menu';
19
+ import Line from '../../components/line';
20
+ import Message from '../../components/message';
21
+ import UserImage from '../../components/userImage';
22
+ import TimeStamp from '../../components/timeStamp';
23
+ import Paragraph from '../../components/paragraph';
24
+ import Composer from '../../components/composer';
25
+ import EmptyBox from '../../components/emptyBox';
26
+ import Tag from '../../components/tag';
27
+ import { Cluster, Stack } from '../../components/layout';
28
+ // A real app reads these from the session.
29
+ var me = 'Dana Lee';
30
+ var agentName = 'Acme Agent';
31
+ var workspaces = ['Acme Design', 'Acme Engineering', 'Acme Marketing'];
32
+ var all = "All ".concat(workspaces.length, " Workspaces");
33
+ // Four things to ask at most, in plain words. Each one fills the Composer, where the person can change it.
34
+ var starters = [
35
+ 'What changed in my workspaces this week?',
36
+ 'What is still open on the launch?',
37
+ 'Who is working on the pricing page?',
38
+ 'What did we decide about the press kit?',
39
+ ];
40
+ // The places. A real app lets each link go to its page.
41
+ var sidebar = (<Navigation aria-label="Main">
42
+ {[
43
+ ['Home', 'House', '/'],
44
+ ['Ask', 'MessageCircle', '/ask'],
45
+ ['Docs', 'BookOpen', '/docs'],
46
+ ].map(function (_a) {
47
+ var label = _a[0], icon = _a[1], href = _a[2];
48
+ return (<MenuItem key={href} size="small" label={label} iconName={icon} href={href} isSelected={href === '/ask'} aria-current={href === '/ask' ? 'page' : undefined} onClick={function (event) { return event.preventDefault(); }}/>);
49
+ })}
50
+ </Navigation>);
51
+ export default function AskPageFirstVisit() {
52
+ var _a = useState(false), navOpen = _a[0], setNavOpen = _a[1];
53
+ // null means every workspace.
54
+ var _b = useState(null), scope = _b[0], setScope = _b[1];
55
+ var _c = useState(null), anchor = _c[0], setAnchor = _c[1];
56
+ var _d = useState(false), open = _d[0], setOpen = _d[1];
57
+ var _e = useState([]), thread = _e[0], setThread = _e[1];
58
+ var _f = useState(''), text = _f[0], setText = _f[1];
59
+ // Set when a starter fills the field; the effect below focuses it with the caret at the end.
60
+ var _g = useState(0), filled = _g[0], setFilled = _g[1];
61
+ var field = useRef(null);
62
+ var label = scope !== null && scope !== void 0 ? scope : all;
63
+ useEffect(function () {
64
+ if (!filled || !field.current)
65
+ return;
66
+ var end = field.current.value.length;
67
+ field.current.focus();
68
+ field.current.setSelectionRange(end, end);
69
+ }, [filled]);
70
+ function choose(next) {
71
+ setScope(next);
72
+ setOpen(false);
73
+ }
74
+ // Fills the field and does not send: the person can change it first.
75
+ function fillWith(starter) {
76
+ setText(starter);
77
+ setFilled(function (n) { return n + 1; });
78
+ }
79
+ function send() {
80
+ // A real app sends the question to the agent here and shows it at once. The agent's progress row follows,
81
+ // with Stop, then the answer with its sources. The 'answered' example shows both.
82
+ setThread(function (rows) { return __spreadArray(__spreadArray([], rows, true), [{ id: "m".concat(rows.length + 1), from: me, at: new Date('2026-11-16T14:40:00Z'), text: text.trim() }], false); });
83
+ setText('');
84
+ }
85
+ return (<AppShell title="Ask" navOpen={navOpen} onNavOpenChange={setNavOpen} sidebar={sidebar}>
86
+ <Stack gap="large">
87
+ <TitleBar title="Ask" actions={
88
+ // The label is the scope. The chevron says it opens a menu.
89
+ <Button size="small" type="tertiary" state={open ? 'selected' : 'enabled'} label={label} actionIcon="ChevronDown" aria-label={"".concat(label, ", change where ").concat(agentName, " looks")} aria-haspopup="menu" aria-expanded={open} onClickButton={function (e) {
90
+ setAnchor(e.currentTarget);
91
+ setOpen(function (o) { return !o; });
92
+ }}/>}/>
93
+ {thread.length === 0 ? (<EmptyBox size="large" icon="MessageCircle" text="No questions yet" secondText={"Ask ".concat(agentName, " anything about your work. It shows where each answer came from.")} action={<Cluster gap="small">
94
+ {starters.map(function (s) { return (<Tag key={s} variant="contained" size="small" label={s} toggle={false} onClick={function () { return fillWith(s); }}/>); })}
95
+ </Cluster>}/>) : (
96
+ // A real app gives the list that holds the rows role="log".
97
+ <Stack gap="small">
98
+ {thread.map(function (m) { return (<Message key={m.id} aria-label={m.from} avatar={<UserImage userHandle={m.from} decorative/>} name={m.from} meta={<TimeStamp createdAt={m.at} dateFormat="absolute" data="time"/>}>
99
+ <Paragraph measure="none">{m.text}</Paragraph>
100
+ </Message>); })}
101
+ </Stack>)}
102
+ <Stack gap="small">
103
+ {/* Where the agent looks, said above the box it is asked in. */}
104
+ <Paragraph size="body2" tone="secondary" measure="none">
105
+ {scope ? "".concat(agentName, " looks in the docs, chats and tasks of ").concat(scope, ".") : "".concat(agentName, " looks in the docs, chats and tasks of all ").concat(workspaces.length, " of your workspaces.")}
106
+ </Paragraph>
107
+ <Composer ref={field} id="ask-page-first-visit-question" aria-label={"Ask ".concat(agentName)} placeholder={"Ask ".concat(agentName)} value={text} onChange={setText} onSubmit={send}/>
108
+ </Stack>
109
+ </Stack>
110
+ <Popover open={open} anchorEl={anchor} onClose={function () { return setOpen(false); }} returnFocus>
111
+ <Menu navigable aria-label={"Where ".concat(agentName, " looks")} width={220}>
112
+ <MenuItem size="small" label={all} isSelected={scope === null} role="menuitemradio" onClick={function () { return choose(null); }}/>
113
+ <Line />
114
+ {workspaces.map(function (w) { return (<MenuItem key={w} size="small" label={w} isSelected={scope === w} role="menuitemradio" onClick={function () { return choose(w); }}/>); })}
115
+ </Menu>
116
+ </Popover>
117
+ </AppShell>);
118
+ }