@swisper.ai/web-chat-ui 0.2.15 → 0.3.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swisper.ai/web-chat-ui",
3
- "version": "0.2.15",
3
+ "version": "0.3.0",
4
4
  "description": "React components for the Swisper chat: messages, composer and cards",
5
5
  "keywords": [
6
6
  "react",
@@ -80,7 +80,6 @@
80
80
  "lexical": "^0.46.0",
81
81
  "mdast": "^3.0.0",
82
82
  "mime": "^4.1.0",
83
- "motion": "^12.23.22",
84
83
  "nanoid": "^5.1.16",
85
84
  "react-intersection-observer": "9.16.0",
86
85
  "rehype-sanitize": "^6.0.0",
@@ -5,7 +5,6 @@ import {
5
5
  ChatThinkingProcessContent,
6
6
  ChatThinkingProcessContentItem,
7
7
  ChatThinkingProcessTrigger,
8
- ChatThinkingProcessTriggerArrow,
9
8
  ChatThinkingProcessTriggerIcon,
10
9
  ChatThinkingProcessTriggerLabel,
11
10
  } from '../../chat-thinking-process';
@@ -24,9 +23,7 @@ export function ToolSteps({ steps }: ToolStepsProps) {
24
23
  </ChatThinkingProcessTriggerIcon>
25
24
  <ChatThinkingProcessTriggerLabel>
26
25
  {`Used ${steps.length} ${steps.length === 1 ? 'tool' : 'tools'}`}
27
- </ChatThinkingProcessTriggerLabel>
28
- <ChatThinkingProcessTriggerArrow />
29
- </ChatThinkingProcessTrigger>
26
+ </ChatThinkingProcessTriggerLabel> </ChatThinkingProcessTrigger>
30
27
  <ChatThinkingProcessContent>
31
28
  {steps.map((step) => (
32
29
  <ChatThinkingProcessContentItem key={step}>{step}</ChatThinkingProcessContentItem>
@@ -1,26 +1,27 @@
1
1
  {
2
2
  "$schema": "../../../../int-eslint-config/schemas/component.schema.json",
3
3
  "component": "chat-thinking-process",
4
- "purpose": "Collapsible disclosure of the assistant's reasoning or tool-use steps above its answer: a trigger (icon, label, chevron) and a timeline of steps, with a shimmering label and a preview of the latest step while the model is still thinking. Parts: ChatThinkingProcessTrigger, ChatThinkingProcessTriggerIcon, ChatThinkingProcessTriggerLabel, ChatThinkingProcessTriggerArrow, ChatThinkingProcessContent, ChatThinkingProcessContentItem.",
4
+ "purpose": "Collapsible disclosure of the assistant's reasoning or tool-use steps above its answer: a trigger (icon, label) and a list of steps, each with an optional logo, with a shimmering label while the model is still thinking. Parts: ChatThinkingProcessTrigger, ChatThinkingProcessTriggerIcon, ChatThinkingProcessTriggerLabel, ChatThinkingProcessContent, ChatThinkingProcessContentItem, ChatThinkingProcessContentItemIcon.",
5
5
  "anatomy": [
6
6
  "import {",
7
7
  " ChatThinkingProcess,",
8
8
  " ChatThinkingProcessTrigger,",
9
9
  " ChatThinkingProcessTriggerIcon,",
10
10
  " ChatThinkingProcessTriggerLabel,",
11
- " ChatThinkingProcessTriggerArrow,",
12
11
  " ChatThinkingProcessContent,",
13
12
  " ChatThinkingProcessContentItem,",
13
+ " ChatThinkingProcessContentItemIcon,",
14
14
  "} from '@swisper.ai/web-chat-ui';",
15
15
  "",
16
16
  "<ChatThinkingProcess>",
17
17
  " <ChatThinkingProcessTrigger>",
18
18
  " <ChatThinkingProcessTriggerIcon />",
19
19
  " <ChatThinkingProcessTriggerLabel />",
20
- " <ChatThinkingProcessTriggerArrow />",
21
20
  " </ChatThinkingProcessTrigger>",
22
21
  " <ChatThinkingProcessContent>",
23
- " <ChatThinkingProcessContentItem />",
22
+ " <ChatThinkingProcessContentItem>",
23
+ " <ChatThinkingProcessContentItemIcon />",
24
+ " </ChatThinkingProcessContentItem>",
24
25
  " </ChatThinkingProcessContent>",
25
26
  "</ChatThinkingProcess>"
26
27
  ],
@@ -32,17 +33,19 @@
32
33
  "avoidWhen": [
33
34
  "A plain wait with no steps to show — use ui/spinner",
34
35
  "Collapsible content that is not the assistant's process (settings, FAQs, details) — use ui/collapsible",
35
- "The answer itself — render it with web-chat-ui/markdown-viewer in the message content"
36
+ "The answer itself — render it with web-chat-ui/markdown-viewer in the message content",
37
+ "Deprecated — leave out ChatThinkingProcessTriggerArrow; it stays only so existing imports keep compiling"
36
38
  ],
37
39
  "uxPrinciples": [
38
- "The answer is the point: the process stays collapsed by default and only previews its latest step while it is live.",
40
+ "The answer is the point: the process stays collapsed by default and shows only its trigger until expanded.",
39
41
  "The label reports state: what is happening while streaming, what was done afterwards ('Used 3 tools')."
40
42
  ],
41
43
  "accessibility": {
42
44
  "required": [
43
45
  "ChatThinkingProcessTriggerLabel must contain text: it is the trigger button's accessible name",
44
46
  "Change the label text when thinking ends ('Thinking…' → 'Used 3 tools'); the shimmer alone does not tell assistive tech the state changed",
45
- "Keep each step's text self-contained; the timeline dots and connectors are hidden from assistive tech"
47
+ "Keep each step's text self-contained",
48
+ "A logo image in ChatThinkingProcessContentItemIcon needs an alt naming the tool, because the step's text may not name it"
46
49
  ],
47
50
  "keyboard": [
48
51
  "Tab focuses the trigger button",
@@ -50,8 +53,8 @@
50
53
  ],
51
54
  "aria": [
52
55
  "The trigger is a Radix Collapsible trigger: a <button> with aria-expanded and aria-controls pointing at the steps",
53
- "ChatThinkingProcessTriggerArrow and the timeline markers are aria-hidden",
54
- "No live region: new steps and the streaming preview are not announced"
56
+ "ChatThinkingProcessTriggerArrow is aria-hidden",
57
+ "No live region: new steps are not announced"
55
58
  ],
56
59
  "focus": [
57
60
  "One tab stop, the trigger; focus stays on it when it toggles",
@@ -62,19 +65,20 @@
62
65
  "states": [
63
66
  "collapsed",
64
67
  "expanded",
65
- "streaming (collapsed, previewing the latest step)",
68
+ "streaming (collapsed)",
66
69
  "streaming (expanded)"
67
70
  ],
68
71
  "rules": [
69
72
  "Uncontrolled by default and collapsed on first render (defaultOpen=false, unlike ui/collapsible); pass open with onOpenChange to control it",
70
- "isStreaming=true marks the model as still thinking: the trigger label shimmers and, while collapsed, the content previews the last step",
71
- "The preview shows the last child of ChatThinkingProcessContent, faded, and cross-fades each time a new step is added; it is hidden when expanded or not streaming. hasLastMessagePreview=false turns it off",
72
- "Expanded, every child of ChatThinkingProcessContent becomes a timeline row with a dot, joined to the next row by a line; the last row has no connector",
73
- "ChatThinkingProcessTriggerArrow rotates 180° when expanded",
74
- "ChatThinkingProcessContent takes a class per element it renders: className (outer wrapper), itemsClassName (the expanded list of steps), rowClassName (each timeline row), markerClassName (the dot), connectorClassName (the line to the next dot) and previewClassName (the streaming preview)",
75
- "Every part takes a className, merged last so it replaces the part's own classes, and sets a data-slot: chat-thinking-process, -trigger, -trigger-icon, -trigger-label, -trigger-arrow, -content, -content-items, -content-row, -content-marker, -content-connector, -content-preview, -content-item",
73
+ "isStreaming=true marks the model as still thinking: the trigger label shimmers",
74
+ "Steps show only when expanded, streaming or not; collapsed, only the trigger shows",
75
+ "Expanded, the children of ChatThinkingProcessContent are listed under the label, indented to line up with its text",
76
+ "ChatThinkingProcessContentItemIcon sits before a step's text at a fixed 14px height; a logo image keeps its own width, so logos of different widths do not line up the text",
77
+ "Deprecated — leave out ChatThinkingProcessTriggerArrow; it stays only so existing imports keep compiling, and still rotates 180° when expanded",
78
+ "ChatThinkingProcessContent takes a class per element it renders: className (outer wrapper) and itemsClassName (the expanded list of steps)",
79
+ "Every part takes a className, merged last so it replaces the part's own classes, and sets a data-slot: chat-thinking-process, -trigger, -trigger-icon, -trigger-label, -trigger-arrow, -content, -content-items, -content-item, -content-item-icon",
76
80
  "The root carries the state as data-state (open / closed) and data-streaming (true / false); style a part from it with group-data-[state=open]/thinking-process: or group-data-[streaming=true]/thinking-process:",
77
- "Other props on ChatThinkingProcessContent go to the expanded list of steps, not to its rows",
81
+ "Other props on ChatThinkingProcessContent go to the expanded list of steps",
78
82
  "A step's content can be any node, including streamed text that grows as it arrives"
79
83
  ]
80
84
  },
@@ -84,15 +88,16 @@
84
88
  "web-chat-ui/ChatThinkingProcessTrigger",
85
89
  "web-chat-ui/ChatThinkingProcessTriggerIcon",
86
90
  "web-chat-ui/ChatThinkingProcessTriggerLabel",
87
- "web-chat-ui/ChatThinkingProcessTriggerArrow",
88
91
  "web-chat-ui/ChatThinkingProcessContent",
89
92
  "web-chat-ui/ChatThinkingProcessContentItem",
93
+ "web-chat-ui/ChatThinkingProcessContentItemIcon",
90
94
  "icon (in ChatThinkingProcessTriggerIcon)",
95
+ "logo image or icon (in ChatThinkingProcessContentItemIcon)",
91
96
  "text label",
92
97
  "step text"
93
98
  ],
94
99
  "avoidCombinations": [
95
- "Children of ChatThinkingProcessContent other than ChatThinkingProcessContentItem — each child becomes a timeline row and the preview uses the last one",
100
+ "Children of ChatThinkingProcessContent other than ChatThinkingProcessContentItem — each child is a step",
96
101
  "Placing it after the answer content — it belongs above web-chat-ui/ChatMessageContent in the assistant's message",
97
102
  "Interactive controls inside steps — the steps are a read-only log"
98
103
  ],
@@ -112,24 +117,18 @@
112
117
  {
113
118
  "condition": "The model is still thinking and no answer text has arrived",
114
119
  "decision": "Set isStreaming on ChatThinkingProcess and keep it collapsed",
115
- "reason": "The shimmer and the latest-step preview show progress without expanding the full log"
120
+ "reason": "The shimmer shows progress without expanding the full log"
116
121
  },
117
122
  {
118
123
  "condition": "Thinking has finished",
119
124
  "decision": "Set isStreaming={false} and change the label to a summary of the steps",
120
- "reason": "The preview hides when not streaming, and the label is the only state cue screen readers get"
121
- },
122
- {
123
- "condition": "The latest-step preview would repeat content shown elsewhere",
124
- "decision": "Pass hasLastMessagePreview={false} to ChatThinkingProcessContent",
125
- "reason": "It switches off the collapsed preview while keeping the expandable list"
125
+ "reason": "The label is the only state cue screen readers get"
126
126
  }
127
127
  ],
128
128
  "relatedComponents": [
129
129
  "ui/collapsible",
130
130
  "web-chat-ui/chat-message",
131
131
  "web-chat-ui/markdown-viewer",
132
- "ui/spinner",
133
- "ui/timeline"
132
+ "ui/spinner"
134
133
  ]
135
134
  }
@@ -1,8 +1,9 @@
1
1
  import type { Meta, StoryObj } from '@storybook/react-vite';
2
2
  import type { ReactNode } from 'react';
3
- import { expect, fn, waitFor } from 'storybook/test';
3
+ import { expect, fn } from 'storybook/test';
4
4
 
5
5
  import { BrainIcon, SearchIcon, ToolIcon } from '@swisper.ai/icons';
6
+ import { ImagePlaceholder } from '@swisper.ai/ui/storybook';
6
7
 
7
8
  import { ParentBlock } from '../../__storybook__/parent-block';
8
9
  import { useStreamingMarkdown } from '../../utils/use-streaming-markdown';
@@ -19,6 +20,7 @@ import {
19
20
  ChatThinkingProcess,
20
21
  ChatThinkingProcessContent,
21
22
  ChatThinkingProcessContentItem,
23
+ ChatThinkingProcessContentItemIcon,
22
24
  ChatThinkingProcessTrigger,
23
25
  ChatThinkingProcessTriggerArrow,
24
26
  ChatThinkingProcessTriggerIcon,
@@ -37,6 +39,7 @@ const meta: Meta<typeof ChatThinkingProcess> = {
37
39
  ChatThinkingProcessTriggerArrow,
38
40
  ChatThinkingProcessContent,
39
41
  ChatThinkingProcessContentItem,
42
+ ChatThinkingProcessContentItemIcon,
40
43
  },
41
44
  parameters: { layout: 'padded' },
42
45
  tags: ['autodocs'],
@@ -50,8 +53,7 @@ const meta: Meta<typeof ChatThinkingProcess> = {
50
53
  argTypes: {
51
54
  isStreaming: {
52
55
  control: 'boolean',
53
- description:
54
- 'Set while the model is still thinking: shimmers the trigger label and, when collapsed, previews the latest step.',
56
+ description: 'Set while the model is still thinking: shimmers the trigger label.',
55
57
  table: { defaultValue: { summary: 'false' } },
56
58
  },
57
59
  defaultOpen: {
@@ -70,7 +72,7 @@ const meta: Meta<typeof ChatThinkingProcess> = {
70
72
  children: {
71
73
  control: false,
72
74
  description:
73
- 'A `ChatThinkingProcessTrigger` (icon, label, arrow) followed by a `ChatThinkingProcessContent` with the steps.',
75
+ 'A `ChatThinkingProcessTrigger` (icon, label) followed by a `ChatThinkingProcessContent` with the steps.',
74
76
  },
75
77
  className: {
76
78
  control: 'text',
@@ -97,9 +99,7 @@ export const Default: Story = {
97
99
  </ChatThinkingProcessTriggerIcon>
98
100
  <ChatThinkingProcessTriggerLabel>
99
101
  Used {EXPENSE_STEPS.length} tools
100
- </ChatThinkingProcessTriggerLabel>
101
- <ChatThinkingProcessTriggerArrow />
102
- </ChatThinkingProcessTrigger>
102
+ </ChatThinkingProcessTriggerLabel> </ChatThinkingProcessTrigger>
103
103
 
104
104
  <ChatThinkingProcessContent>
105
105
  {EXPENSE_STEPS.map((step) => (
@@ -110,29 +110,36 @@ export const Default: Story = {
110
110
  ),
111
111
  };
112
112
 
113
- /** Still thinking with the preview switched off: the label shimmers, and the steps show only once expanded. */
114
- export const WithoutPreview: Story = {
115
- args: { isStreaming: true },
113
+ /** Expanded steps that each open with the logo of the tool they used. Logos keep their own width. */
114
+ export const WithItemIcons: Story = {
115
+ args: { defaultOpen: true },
116
116
  render: (args) => (
117
117
  <ChatThinkingProcess {...args}>
118
118
  <ChatThinkingProcessTrigger>
119
119
  <ChatThinkingProcessTriggerIcon>
120
- <BrainIcon />
120
+ <ToolIcon />
121
121
  </ChatThinkingProcessTriggerIcon>
122
- <ChatThinkingProcessTriggerLabel>Thinking…</ChatThinkingProcessTriggerLabel>
123
- <ChatThinkingProcessTriggerArrow />
124
- </ChatThinkingProcessTrigger>
122
+ <ChatThinkingProcessTriggerLabel>Mobility tool execution</ChatThinkingProcessTriggerLabel> </ChatThinkingProcessTrigger>
125
123
 
126
- <ChatThinkingProcessContent hasLastMessagePreview={false}>
127
- {EXPENSE_STEPS.slice(0, 2).map((step) => (
128
- <ChatThinkingProcessContentItem key={step}>{step}</ChatThinkingProcessContentItem>
129
- ))}
124
+ <ChatThinkingProcessContent>
125
+ <ChatThinkingProcessContentItem>
126
+ <ChatThinkingProcessContentItemIcon>
127
+ <ImagePlaceholder className="h-[14px] w-[128px] overflow-hidden" />
128
+ </ChatThinkingProcessContentItemIcon>
129
+ Searching return trains to Winterthur
130
+ </ChatThinkingProcessContentItem>
131
+ <ChatThinkingProcessContentItem>
132
+ <ChatThinkingProcessContentItemIcon>
133
+ <ImagePlaceholder className="h-[14px] w-[48px] overflow-hidden" />
134
+ </ChatThinkingProcessContentItemIcon>
135
+ Searching hotels in Interlaken
136
+ </ChatThinkingProcessContentItem>
130
137
  </ChatThinkingProcessContent>
131
138
  </ChatThinkingProcess>
132
139
  ),
133
140
  };
134
141
 
135
- /** Still thinking: the label shimmers and the latest step is previewed under the collapsed trigger. */
142
+ /** Still thinking: the label shimmers, and the steps show only once expanded. */
136
143
  export const Streaming: Story = {
137
144
  args: { isStreaming: true },
138
145
  render: (args) => (
@@ -141,9 +148,7 @@ export const Streaming: Story = {
141
148
  <ChatThinkingProcessTriggerIcon>
142
149
  <BrainIcon />
143
150
  </ChatThinkingProcessTriggerIcon>
144
- <ChatThinkingProcessTriggerLabel>Thinking…</ChatThinkingProcessTriggerLabel>
145
- <ChatThinkingProcessTriggerArrow />
146
- </ChatThinkingProcessTrigger>
151
+ <ChatThinkingProcessTriggerLabel>Thinking…</ChatThinkingProcessTriggerLabel> </ChatThinkingProcessTrigger>
147
152
 
148
153
  <ChatThinkingProcessContent>
149
154
  {EXPENSE_STEPS.slice(0, 2).map((step) => (
@@ -168,9 +173,7 @@ export const StreamingWithContent: Story = {
168
173
  </ChatThinkingProcessTriggerIcon>
169
174
  <ChatThinkingProcessTriggerLabel>
170
175
  {isStreaming ? 'Thinking…' : 'Used 2 tools'}
171
- </ChatThinkingProcessTriggerLabel>
172
- <ChatThinkingProcessTriggerArrow />
173
- </ChatThinkingProcessTrigger>
176
+ </ChatThinkingProcessTriggerLabel> </ChatThinkingProcessTrigger>
174
177
  <ChatThinkingProcessContent>
175
178
  <ChatThinkingProcessContentItem>Connecting to mailbox…</ChatThinkingProcessContentItem>
176
179
  <ChatThinkingProcessContentItem className="whitespace-pre-wrap">
@@ -190,22 +193,19 @@ export const DefaultOpenAndClose: Story = {
190
193
  play: async ({ args, canvas, userEvent, step }) => {
191
194
  const trigger = canvas.getByRole('button', { name: 'Used 4 tools' });
192
195
 
193
- await step('Starts collapsed with no step and no preview', async () => {
196
+ await step('Starts collapsed with no step', async () => {
194
197
  await expect(trigger).toHaveAttribute('aria-expanded', 'false');
195
- await expect(canvas.queryByText(EXPENSE_STEPS[0])).toBeNull();
196
- // The last step stays mounted for the preview, which only shows while streaming.
197
- await expect(canvas.getByText(EXPENSE_STEPS[3])).not.toBeVisible();
198
+ for (const text of EXPENSE_STEPS) {
199
+ await expect(canvas.queryByText(text)).toBeNull();
200
+ }
198
201
  });
199
202
 
200
203
  await step('Expands to every step', async () => {
201
204
  await userEvent.click(trigger);
202
205
  await expect(trigger).toHaveAttribute('aria-expanded', 'true');
203
- for (const text of EXPENSE_STEPS.slice(0, 3)) {
206
+ for (const text of EXPENSE_STEPS) {
204
207
  await expect(canvas.getByText(text)).toBeVisible();
205
208
  }
206
- await expect(
207
- canvas.getAllByText(EXPENSE_STEPS[3]).filter((copy) => copy.checkVisibility()),
208
- ).toHaveLength(1);
209
209
  await expect(args.onOpenChange).toHaveBeenLastCalledWith(true);
210
210
  });
211
211
 
@@ -248,8 +248,8 @@ export const DefaultKeyboard: Story = {
248
248
  },
249
249
  };
250
250
 
251
- /** While streaming, the collapsed process previews its last step and drops the preview once expanded. */
252
- export const StreamingPreview: Story = {
251
+ /** While streaming, a collapsed process shows no step until it is expanded. */
252
+ export const StreamingHidesSteps: Story = {
253
253
  ...Streaming,
254
254
  tags: ['e2e', '!autodocs'],
255
255
  args: { isStreaming: true, onOpenChange: fn() },
@@ -257,50 +257,23 @@ export const StreamingPreview: Story = {
257
257
  const trigger = canvas.getByRole('button', { name: 'Thinking…' });
258
258
  const [firstStep, lastStep] = EXPENSE_STEPS;
259
259
 
260
- await step('Collapsed: only the last step shows, as the preview', async () => {
260
+ await step('Collapsed: no step is rendered', async () => {
261
261
  await expect(trigger).toHaveAttribute('aria-expanded', 'false');
262
- // The preview fades in.
263
- await waitFor(() => expect(canvas.getByText(lastStep)).toBeVisible());
264
262
  await expect(canvas.queryByText(firstStep)).toBeNull();
263
+ await expect(canvas.queryByText(lastStep)).toBeNull();
265
264
  });
266
265
 
267
- await step('Expanded: the full list replaces the preview', async () => {
266
+ await step('Expanded: each step shows once', async () => {
268
267
  await userEvent.click(trigger);
269
268
  await expect(canvas.getByText(firstStep)).toBeVisible();
270
- const lastStepCopies = canvas.getAllByText(lastStep);
271
- await expect(lastStepCopies).toHaveLength(2);
272
- await expect(
273
- lastStepCopies.filter((copy) => copy.checkVisibility({ opacityProperty: true })),
274
- ).toHaveLength(1);
275
- });
276
-
277
- await step('Collapsed again: the preview is back', async () => {
278
- await userEvent.click(trigger);
279
- await expect(canvas.queryByText(firstStep)).toBeNull();
280
269
  await expect(canvas.getByText(lastStep)).toBeVisible();
281
270
  });
282
- },
283
- };
284
-
285
- /** With the preview off, a streaming process shows no step until it is expanded. */
286
- export const WithoutPreviewHidesSteps: Story = {
287
- ...WithoutPreview,
288
- tags: ['e2e', '!autodocs'],
289
- args: { isStreaming: true, onOpenChange: fn() },
290
- play: async ({ canvas, userEvent, step }) => {
291
- const trigger = canvas.getByRole('button', { name: 'Thinking…' });
292
- const [firstStep, lastStep] = EXPENSE_STEPS;
293
271
 
294
- await step('Collapsed: no step is rendered', async () => {
272
+ await step('Collapsed again: no step is rendered', async () => {
273
+ await userEvent.click(trigger);
295
274
  await expect(canvas.queryByText(firstStep)).toBeNull();
296
275
  await expect(canvas.queryByText(lastStep)).toBeNull();
297
276
  });
298
-
299
- await step('Expanded: each step shows once', async () => {
300
- await userEvent.click(trigger);
301
- await expect(canvas.getByText(firstStep)).toBeVisible();
302
- await expect(canvas.getByText(lastStep)).toBeVisible();
303
- });
304
277
  },
305
278
  };
306
279
 
@@ -316,9 +289,7 @@ export const Examples: Story = {
316
289
  <ChatThinkingProcessTriggerIcon>
317
290
  <BrainIcon />
318
291
  </ChatThinkingProcessTriggerIcon>
319
- <ChatThinkingProcessTriggerLabel>Thinking…</ChatThinkingProcessTriggerLabel>
320
- <ChatThinkingProcessTriggerArrow />
321
- </ChatThinkingProcessTrigger>
292
+ <ChatThinkingProcessTriggerLabel>Thinking…</ChatThinkingProcessTriggerLabel> </ChatThinkingProcessTrigger>
322
293
  <ChatThinkingProcessContent>
323
294
  {EXPENSE_STEPS.slice(0, 2).map((step) => (
324
295
  <ChatThinkingProcessContentItem key={step}>{step}</ChatThinkingProcessContentItem>
@@ -339,9 +310,7 @@ export const Examples: Story = {
339
310
  <ChatThinkingProcessTriggerIcon>
340
311
  <BrainIcon />
341
312
  </ChatThinkingProcessTriggerIcon>
342
- <ChatThinkingProcessTriggerLabel>Reasoned for 12s</ChatThinkingProcessTriggerLabel>
343
- <ChatThinkingProcessTriggerArrow />
344
- </ChatThinkingProcessTrigger>
313
+ <ChatThinkingProcessTriggerLabel>Reasoned for 12s</ChatThinkingProcessTriggerLabel> </ChatThinkingProcessTrigger>
345
314
  <ChatThinkingProcessContent>
346
315
  <ChatThinkingProcessContentItem>{AGENT_REASONING}</ChatThinkingProcessContentItem>
347
316
  </ChatThinkingProcessContent>
@@ -357,19 +326,11 @@ export const Examples: Story = {
357
326
  interface ChatThinkingProcessPlaygroundProps
358
327
  extends
359
328
  Omit<ChatThinkingProcessProps, 'children'>,
360
- Pick<
361
- ChatThinkingProcessContentProps,
362
- | 'itemsClassName'
363
- | 'rowClassName'
364
- | 'markerClassName'
365
- | 'connectorClassName'
366
- | 'previewClassName'
367
- | 'hasLastMessagePreview'
368
- > {
329
+ Pick<ChatThinkingProcessContentProps, 'itemsClassName'> {
369
330
  label: string;
370
331
  icon: ReactNode;
371
332
  stepCount: number;
372
- hasArrow: boolean;
333
+ hasItemIcons: boolean;
373
334
  }
374
335
 
375
336
  function ChatThinkingProcessPlayground({
@@ -377,13 +338,8 @@ function ChatThinkingProcessPlayground({
377
338
  icon,
378
339
  stepCount,
379
340
  itemsClassName,
380
- rowClassName,
381
- markerClassName,
382
- connectorClassName,
383
- previewClassName,
384
341
  defaultOpen,
385
- hasArrow,
386
- hasLastMessagePreview,
342
+ hasItemIcons,
387
343
  ...rest
388
344
  }: ChatThinkingProcessPlaygroundProps) {
389
345
  return (
@@ -392,26 +348,25 @@ function ChatThinkingProcessPlayground({
392
348
  <ChatThinkingProcessTrigger>
393
349
  {icon && <ChatThinkingProcessTriggerIcon>{icon}</ChatThinkingProcessTriggerIcon>}
394
350
  <ChatThinkingProcessTriggerLabel>{label}</ChatThinkingProcessTriggerLabel>
395
- {hasArrow && <ChatThinkingProcessTriggerArrow />}
396
351
  </ChatThinkingProcessTrigger>
397
352
 
398
- <ChatThinkingProcessContent
399
- itemsClassName={itemsClassName}
400
- rowClassName={rowClassName}
401
- markerClassName={markerClassName}
402
- connectorClassName={connectorClassName}
403
- previewClassName={previewClassName}
404
- hasLastMessagePreview={hasLastMessagePreview}
405
- >
353
+ <ChatThinkingProcessContent itemsClassName={itemsClassName}>
406
354
  {EXPENSE_STEPS.slice(0, stepCount).map((step) => (
407
- <ChatThinkingProcessContentItem key={step}>{step}</ChatThinkingProcessContentItem>
355
+ <ChatThinkingProcessContentItem key={step}>
356
+ {hasItemIcons && (
357
+ <ChatThinkingProcessContentItemIcon>
358
+ <ImagePlaceholder className="h-[14px] w-[48px] overflow-hidden" />
359
+ </ChatThinkingProcessContentItemIcon>
360
+ )}
361
+ {step}
362
+ </ChatThinkingProcessContentItem>
408
363
  ))}
409
364
  </ChatThinkingProcessContent>
410
365
  </ChatThinkingProcess>
411
366
  );
412
367
  }
413
368
 
414
- /** Every part at once, with each part and prop of the root and the content on the Controls panel. */
369
+ /** Every supported part at once, with each part and prop of the root and the content on the Controls panel. */
415
370
  export const Playground: StoryObj<typeof ChatThinkingProcessPlayground> = {
416
371
  tags: ['!autodocs'],
417
372
  args: {
@@ -420,8 +375,7 @@ export const Playground: StoryObj<typeof ChatThinkingProcessPlayground> = {
420
375
  stepCount: EXPENSE_STEPS.length,
421
376
  isStreaming: true,
422
377
  defaultOpen: false,
423
- hasArrow: true,
424
- hasLastMessagePreview: true,
378
+ hasItemIcons: false,
425
379
  onOpenChange: fn(),
426
380
  },
427
381
  argTypes: {
@@ -445,34 +399,14 @@ export const Playground: StoryObj<typeof ChatThinkingProcessPlayground> = {
445
399
  control: { type: 'number', min: 0, max: EXPENSE_STEPS.length },
446
400
  description: 'Number of `ChatThinkingProcessContentItem` steps.',
447
401
  },
448
- hasArrow: { control: 'boolean', description: 'Renders `ChatThinkingProcessTriggerArrow`.' },
449
- hasLastMessagePreview: {
402
+ hasItemIcons: {
450
403
  control: 'boolean',
451
- description:
452
- '`hasLastMessagePreview` on `ChatThinkingProcessContent`: previews the last step while streaming and collapsed.',
404
+ description: 'Renders a `ChatThinkingProcessContentItemIcon` in each step.',
453
405
  },
454
406
  itemsClassName: {
455
407
  control: 'text',
456
408
  description: '`itemsClassName` on `ChatThinkingProcessContent`: the expanded list of steps.',
457
409
  },
458
- rowClassName: {
459
- control: 'text',
460
- description: '`rowClassName` on `ChatThinkingProcessContent`: each timeline row.',
461
- },
462
- markerClassName: {
463
- control: 'text',
464
- description: '`markerClassName` on `ChatThinkingProcessContent`: the dot of each step.',
465
- },
466
- connectorClassName: {
467
- control: 'text',
468
- description:
469
- '`connectorClassName` on `ChatThinkingProcessContent`: the line between two dots.',
470
- },
471
- previewClassName: {
472
- control: 'text',
473
- description:
474
- '`previewClassName` on `ChatThinkingProcessContent`: the preview of the last step.',
475
- },
476
410
  },
477
411
  render: (args) => <ChatThinkingProcessPlayground {...args} />,
478
412
  };