@gravity-ui/aikit 3.5.0 → 3.6.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/build/cjs/components/organisms/{ThinkingMessageGroup/ThinkingMessageGroup.css → ActivityList/ActivityList.css} +46 -14
- package/build/cjs/components/organisms/ActivityList/ActivityList.d.ts +3 -0
- package/build/cjs/components/organisms/ActivityList/ActivityList.js +93 -0
- package/build/cjs/components/organisms/ActivityList/ActivityList.js.map +1 -0
- package/build/cjs/components/organisms/ActivityList/CompactHeading.d.ts +11 -0
- package/build/cjs/components/organisms/{ThinkingMessageGroup → ActivityList}/CompactHeading.js +10 -7
- package/build/cjs/components/organisms/ActivityList/CompactHeading.js.map +1 -0
- package/build/cjs/components/organisms/ActivityList/StepIcon.d.ts +7 -0
- package/build/cjs/components/organisms/{ThinkingMessageGroup → ActivityList}/StepIcon.js +12 -2
- package/build/cjs/components/organisms/ActivityList/StepIcon.js.map +1 -0
- package/build/cjs/components/organisms/ActivityList/i18n/index.js.map +1 -0
- package/build/cjs/components/organisms/ActivityList/index.d.ts +7 -0
- package/build/cjs/components/organisms/ActivityList/index.js +11 -0
- package/build/cjs/components/organisms/ActivityList/index.js.map +1 -0
- package/build/cjs/components/organisms/ActivityList/types.d.ts +41 -0
- package/build/cjs/components/organisms/ActivityList/types.js +3 -0
- package/build/cjs/components/organisms/ActivityList/types.js.map +1 -0
- package/build/{esm/components/organisms/ThinkingMessageGroup → cjs/components/organisms/ActivityList}/utils.d.ts +4 -4
- package/build/cjs/components/organisms/ActivityList/utils.js.map +1 -0
- package/build/cjs/components/organisms/AssistantMessage/AssistantMessage.js +3 -3
- package/build/cjs/components/organisms/AssistantMessage/AssistantMessage.js.map +1 -1
- package/build/cjs/components/organisms/ThinkingMessage/ThinkingMessage.d.ts +1 -1
- package/build/cjs/components/organisms/ThinkingMessage/ThinkingMessage.js +1 -1
- package/build/cjs/components/organisms/ThinkingMessage/ThinkingMessage.js.map +1 -1
- package/build/cjs/components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.d.ts +3 -3
- package/build/cjs/components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.js +4 -83
- package/build/cjs/components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.js.map +1 -1
- package/build/cjs/components/organisms/ThinkingMessageGroup/ThinkingMessageGroupWithMarkdown.d.ts +1 -1
- package/build/cjs/components/organisms/ThinkingMessageGroup/index.d.ts +7 -3
- package/build/cjs/components/organisms/ThinkingMessageGroup/index.js +7 -5
- package/build/cjs/components/organisms/ThinkingMessageGroup/index.js.map +1 -1
- package/build/cjs/components/organisms/ThinkingMessageGroup/types.d.ts +9 -37
- package/build/cjs/components/organisms/ThinkingMessageGroup/types.js.map +1 -1
- package/build/cjs/components/organisms/index.d.ts +1 -0
- package/build/cjs/components/organisms/index.js +1 -0
- package/build/cjs/components/organisms/index.js.map +1 -1
- package/build/cjs/custom-markdown/index.d.ts +3 -1
- package/build/cjs/custom-markdown/index.js +2 -1
- package/build/cjs/custom-markdown/index.js.map +1 -1
- package/build/cjs/package.json +1 -1
- package/build/docs/INDEX.md +2 -1
- package/build/docs/components/organisms/ActivityList.md +204 -0
- package/build/docs/components/organisms/AssistantMessage.md +1 -1
- package/build/docs/components/organisms/MessageList.md +1 -1
- package/build/docs/components/organisms/ThinkingMessage.md +1 -1
- package/build/docs/components/organisms/ThinkingMessageGroup.md +21 -122
- package/build/docs/components/pages/ChatContainer.md +1 -1
- package/build/docs/guides/COMPONENTS.md +15 -14
- package/build/docs/guides/PROJECT_STRUCTURE.md +3 -2
- package/build/esm/components/organisms/{ThinkingMessageGroup/ThinkingMessageGroup.css → ActivityList/ActivityList.css} +46 -14
- package/build/esm/components/organisms/ActivityList/ActivityList.d.ts +3 -0
- package/build/esm/components/organisms/ActivityList/ActivityList.js +90 -0
- package/build/esm/components/organisms/ActivityList/ActivityList.js.map +1 -0
- package/build/esm/components/organisms/ActivityList/CompactHeading.d.ts +11 -0
- package/build/esm/components/organisms/{ThinkingMessageGroup → ActivityList}/CompactHeading.js +10 -7
- package/build/esm/components/organisms/ActivityList/CompactHeading.js.map +1 -0
- package/build/esm/components/organisms/ActivityList/StepIcon.d.ts +7 -0
- package/build/esm/components/organisms/ActivityList/StepIcon.js +27 -0
- package/build/esm/components/organisms/ActivityList/StepIcon.js.map +1 -0
- package/build/esm/components/organisms/ActivityList/i18n/index.js.map +1 -0
- package/build/esm/components/organisms/ActivityList/index.d.ts +7 -0
- package/build/esm/components/organisms/ActivityList/index.js +6 -0
- package/build/esm/components/organisms/ActivityList/index.js.map +1 -0
- package/build/esm/components/organisms/ActivityList/types.d.ts +41 -0
- package/build/esm/components/organisms/ActivityList/types.js +2 -0
- package/build/esm/components/organisms/ActivityList/types.js.map +1 -0
- package/build/{cjs/components/organisms/ThinkingMessageGroup → esm/components/organisms/ActivityList}/utils.d.ts +4 -4
- package/build/esm/components/organisms/ActivityList/utils.js.map +1 -0
- package/build/esm/components/organisms/AssistantMessage/AssistantMessage.js +3 -3
- package/build/esm/components/organisms/AssistantMessage/AssistantMessage.js.map +1 -1
- package/build/esm/components/organisms/ThinkingMessage/ThinkingMessage.d.ts +1 -1
- package/build/esm/components/organisms/ThinkingMessage/ThinkingMessage.js +1 -1
- package/build/esm/components/organisms/ThinkingMessage/ThinkingMessage.js.map +1 -1
- package/build/esm/components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.d.ts +3 -3
- package/build/esm/components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.js +3 -82
- package/build/esm/components/organisms/ThinkingMessageGroup/ThinkingMessageGroup.js.map +1 -1
- package/build/esm/components/organisms/ThinkingMessageGroup/ThinkingMessageGroupWithMarkdown.d.ts +1 -1
- package/build/esm/components/organisms/ThinkingMessageGroup/index.d.ts +7 -3
- package/build/esm/components/organisms/ThinkingMessageGroup/index.js +5 -2
- package/build/esm/components/organisms/ThinkingMessageGroup/index.js.map +1 -1
- package/build/esm/components/organisms/ThinkingMessageGroup/types.d.ts +9 -37
- package/build/esm/components/organisms/ThinkingMessageGroup/types.js.map +1 -1
- package/build/esm/components/organisms/index.d.ts +1 -0
- package/build/esm/components/organisms/index.js +1 -0
- package/build/esm/components/organisms/index.js.map +1 -1
- package/build/esm/custom-markdown/index.d.ts +3 -1
- package/build/esm/custom-markdown/index.js +2 -1
- package/build/esm/custom-markdown/index.js.map +1 -1
- package/build/esm/package.json +1 -1
- package/docs/COMPONENTS.md +15 -14
- package/docs/PROJECT_STRUCTURE.md +3 -2
- package/llms-full.txt +19 -17
- package/llms.txt +2 -1
- package/package.json +11 -1
- package/build/cjs/components/organisms/ThinkingMessageGroup/CompactHeading.d.ts +0 -11
- package/build/cjs/components/organisms/ThinkingMessageGroup/CompactHeading.js.map +0 -1
- package/build/cjs/components/organisms/ThinkingMessageGroup/StepIcon.d.ts +0 -6
- package/build/cjs/components/organisms/ThinkingMessageGroup/StepIcon.js.map +0 -1
- package/build/cjs/components/organisms/ThinkingMessageGroup/i18n/index.js.map +0 -1
- package/build/cjs/components/organisms/ThinkingMessageGroup/utils.js.map +0 -1
- package/build/esm/components/organisms/ThinkingMessageGroup/CompactHeading.d.ts +0 -11
- package/build/esm/components/organisms/ThinkingMessageGroup/CompactHeading.js.map +0 -1
- package/build/esm/components/organisms/ThinkingMessageGroup/StepIcon.d.ts +0 -6
- package/build/esm/components/organisms/ThinkingMessageGroup/StepIcon.js +0 -17
- package/build/esm/components/organisms/ThinkingMessageGroup/StepIcon.js.map +0 -1
- package/build/esm/components/organisms/ThinkingMessageGroup/i18n/index.js.map +0 -1
- package/build/esm/components/organisms/ThinkingMessageGroup/utils.js.map +0 -1
- /package/build/cjs/components/organisms/{ThinkingMessageGroup → ActivityList}/i18n/en.json +0 -0
- /package/build/cjs/components/organisms/{ThinkingMessageGroup → ActivityList}/i18n/index.d.ts +0 -0
- /package/build/cjs/components/organisms/{ThinkingMessageGroup → ActivityList}/i18n/index.js +0 -0
- /package/build/cjs/components/organisms/{ThinkingMessageGroup → ActivityList}/i18n/ru.json +0 -0
- /package/build/cjs/components/organisms/{ThinkingMessageGroup → ActivityList}/utils.js +0 -0
- /package/build/esm/components/organisms/{ThinkingMessageGroup → ActivityList}/i18n/en.json +0 -0
- /package/build/esm/components/organisms/{ThinkingMessageGroup → ActivityList}/i18n/index.d.ts +0 -0
- /package/build/esm/components/organisms/{ThinkingMessageGroup → ActivityList}/i18n/index.js +0 -0
- /package/build/esm/components/organisms/{ThinkingMessageGroup → ActivityList}/i18n/ru.json +0 -0
- /package/build/esm/components/organisms/{ThinkingMessageGroup → ActivityList}/utils.js +0 -0
|
@@ -1,146 +1,45 @@
|
|
|
1
1
|
# ThinkingMessageGroup
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Compatibility alias for the [ActivityList](./ActivityList.md) component.
|
|
4
|
+
|
|
5
|
+
> Deprecated: use `ActivityList`. Existing imports and props remain supported; removal requires a future major release.
|
|
4
6
|
|
|
5
7
|
## Features
|
|
6
8
|
|
|
7
|
-
- **
|
|
8
|
-
- **
|
|
9
|
-
- **
|
|
10
|
-
- **Text-only animation**: only the current running label pulses; icons remain static and reduced motion is respected.
|
|
11
|
-
- **Details and copy**: plain text, Markdown, custom content and per-step copy actions.
|
|
12
|
-
- **Stable expansion**: uncontrolled or controlled disclosure stays open during streaming updates.
|
|
9
|
+
- **Same implementation**: `ThinkingMessageGroup === ActivityList`; no wrapper or duplicate rendering logic.
|
|
10
|
+
- **Compatible imports**: both the package root and `@gravity-ui/aikit/ThinkingMessageGroup` remain available.
|
|
11
|
+
- **Gradual migration**: existing props, status values, helpers and styles continue to work.
|
|
13
12
|
|
|
14
13
|
## Usage
|
|
15
14
|
|
|
16
|
-
|
|
15
|
+
Existing code remains valid:
|
|
17
16
|
|
|
18
17
|
```tsx
|
|
19
|
-
|
|
20
|
-
{...chatProps}
|
|
21
|
-
messageListConfig={{...messageListConfig, thinkingMessageView: 'grouped'}}
|
|
22
|
-
/>
|
|
23
|
-
```
|
|
24
|
-
|
|
25
|
-
`MessageList` and `AssistantMessage` also accept `thinkingMessageView="grouped"`.
|
|
26
|
-
The default remains the legacy view. Adjacent thinking parts **inside the same assistant message**
|
|
27
|
-
become one group. Text, tools and custom content remain in order and break groups.
|
|
28
|
-
An existing custom `messageRendererRegistry.thinking` takes precedence: remove that override to
|
|
29
|
-
use automatic grouping, or explicitly render `ThinkingMessageGroup` in your custom renderer.
|
|
30
|
-
Markdown configuration is forwarded. The new view starts collapsed; it does not inherit individual
|
|
31
|
-
legacy `defaultExpanded` or `showStatusIndicator` settings.
|
|
32
|
-
|
|
33
|
-
### Replace a custom thinking renderer
|
|
34
|
-
|
|
35
|
-
```tsx
|
|
36
|
-
import {ThinkingMessageGroup, thinkingMessageToStep} from '@gravity-ui/aikit/ThinkingMessageGroup';
|
|
18
|
+
import {ThinkingMessageGroup} from '@gravity-ui/aikit/ThinkingMessageGroup';
|
|
37
19
|
|
|
38
|
-
<ThinkingMessageGroup
|
|
39
|
-
steps={[thinkingMessageToStep(messageId, part.data)]}
|
|
40
|
-
format="markdown"
|
|
41
|
-
openMarkdownLinksInNewTab
|
|
42
|
-
/>;
|
|
20
|
+
<ThinkingMessageGroup steps={steps} />;
|
|
43
21
|
```
|
|
44
22
|
|
|
45
|
-
|
|
46
|
-
`content` is an array of paragraphs. Titles, contents, statuses and copy callbacks are preserved.
|
|
47
|
-
No category or action name is inferred from reasoning text. Missing titles use localized status text.
|
|
48
|
-
|
|
49
|
-
### Supply structured steps
|
|
23
|
+
For new code, or when migrating, change the import and component name:
|
|
50
24
|
|
|
51
25
|
```tsx
|
|
52
|
-
import {
|
|
53
|
-
import {Icon} from '@gravity-ui/uikit';
|
|
54
|
-
import {ThinkingMessageGroup} from '@gravity-ui/aikit/ThinkingMessageGroup';
|
|
26
|
+
import {ActivityList} from '@gravity-ui/aikit/ActivityList';
|
|
55
27
|
|
|
56
|
-
<
|
|
57
|
-
steps={[
|
|
58
|
-
{id: 'analyze', type: 'reasoning', title: 'Analyzed the request', status: 'thought'},
|
|
59
|
-
{id: 'search', type: 'search', title: 'Searching documentation', status: 'thinking'},
|
|
60
|
-
]}
|
|
61
|
-
stepTypes={{search: {icon: <Icon data={Magnifier} size={16} />, label: 'Documentation search'}}}
|
|
62
|
-
status="thinking"
|
|
63
|
-
activeStepId="search"
|
|
64
|
-
/>;
|
|
28
|
+
<ActivityList steps={steps} />;
|
|
65
29
|
```
|
|
66
30
|
|
|
67
|
-
Types have no fixed enum. Running and completed steps keep their category icon, or a static dot
|
|
68
|
-
when none is supplied. Error, paused and cancelled steps use their status icon instead. Category labels appear
|
|
69
|
-
only in the expanded history. Applications choose icons; the component does not map backend event
|
|
70
|
-
names to icons. Details can be omitted when the backend does not supply them.
|
|
71
|
-
|
|
72
31
|
## Props
|
|
73
32
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
| `activeStepId` | `string` | No | Last thinking step | Select the active step explicitly |
|
|
80
|
-
| `expanded` | `boolean` | No | — | Controlled expansion |
|
|
81
|
-
| `defaultExpanded` | `boolean` | No | `false` | Initial uncontrolled expansion |
|
|
82
|
-
| `maxHistoryHeight` | `CSSProperties['maxHeight']` | No | `480` | Maximum expanded history height; use `"none"` to disable the limit |
|
|
83
|
-
| `onExpandedChange` | `(expanded: boolean) => void` | No | — | Disclosure change callback |
|
|
84
|
-
| `renderSummary` | `(completedSteps: ThinkingStep[]) => ReactNode` | No | Completed count | Optional summary; null, false and empty string hide it |
|
|
85
|
-
| `renderStepContent` | `(step: ThinkingStep) => ReactNode` | No | Content renderer | Custom details |
|
|
86
|
-
| `format` | `'plain' \| 'markdown'` | No | `'plain'` | Content format |
|
|
87
|
-
| `className`, `style`, `qa` | Standard DOM/QA props | No | — | Root customization |
|
|
88
|
-
|
|
89
|
-
Markdown options match `ThinkingMessage`: `transformOptions`, `mermaidOptions`,
|
|
90
|
-
`openMarkdownLinksInNewTab`, `mdxOptions`, `mdxContext`, `markdownExtraProps`.
|
|
91
|
-
|
|
92
|
-
`ThinkingStep` contains `id`, `type`, `status`, optional `title`, `content`, `enabledCopy` and
|
|
93
|
-
`onCopyClick`. Copy is available for non-running steps; a custom callback takes precedence.
|
|
94
|
-
`ThinkingStepStatus` is `thinking | thought | error | cancelled | paused`.
|
|
95
|
-
An empty group renders nothing. A single completed step remains expandable so its title is accessible.
|
|
96
|
-
|
|
97
|
-
## Group separate messages safely
|
|
98
|
-
|
|
99
|
-
`groupThinkingMessages(items, {getStep, getGroupKey})` is a pure view transformation. It returns
|
|
100
|
-
`{type: 'item', item, index}` entries or `{type: 'thinking-group', id, groupKey, items, steps}` entries.
|
|
101
|
-
It retains source objects and individual step IDs/content/statuses without merging text or mutating history.
|
|
102
|
-
|
|
103
|
-
```tsx
|
|
104
|
-
const entries = groupThinkingMessages(messages, {
|
|
105
|
-
getStep: (message) => {
|
|
106
|
-
// Only group whole messages containing exactly one thinking part.
|
|
107
|
-
if (message.role !== 'assistant' || !Array.isArray(message.content)) return undefined;
|
|
108
|
-
if (message.content.length !== 1 || message.content[0].type !== 'thinking') return undefined;
|
|
109
|
-
if (!message.id) return undefined;
|
|
110
|
-
return thinkingMessageToStep(message.id, message.content[0].data);
|
|
111
|
-
},
|
|
112
|
-
getGroupKey: (message) => {
|
|
113
|
-
const runId = message.metadata?.runId;
|
|
114
|
-
return typeof runId === 'string' ? JSON.stringify([threadId, runId]) : undefined;
|
|
115
|
-
},
|
|
116
|
-
});
|
|
117
|
-
```
|
|
118
|
-
|
|
119
|
-
Supply a key that uniquely identifies a chat and response/run; use a new key for a retry.
|
|
120
|
-
An undefined key leaves a thinking item in its own group. Non-thinking items and key changes break
|
|
121
|
-
the group. Non-adjacent items are never combined. Render each group with `key={entry.id}` and
|
|
122
|
-
`steps={entry.steps}`. The generated ID depends on the scope and first step, so appending steps or
|
|
123
|
-
updating details does not remount it. Provide stable unique IDs; index fallbacks in automatic
|
|
124
|
-
part grouping are suitable only for append-only content arrays.
|
|
125
|
-
|
|
126
|
-
Cross-message grouping is deliberately application-controlled: AIKit cannot infer run boundaries
|
|
127
|
-
from adjacency or generic metadata. Streaming delta accumulation remains the adapter's job.
|
|
128
|
-
The component does not infer cancellation/failure from completion; pass the actual run status.
|
|
129
|
-
|
|
130
|
-
## Migration
|
|
131
|
-
|
|
132
|
-
`ThinkingMessage` is deprecated in favor of this component, with removal planned for the next major
|
|
133
|
-
release. Its implementation, props and `ThinkingMessageContentData` remain compatible in the current
|
|
134
|
-
major. There are no runtime warnings and no automatic switch of the default view.
|
|
135
|
-
|
|
136
|
-
## Accessibility
|
|
33
|
+
All props are identical to [ActivityList props](./ActivityList.md#props).
|
|
34
|
+
The deprecated `ThinkingMessageGroupProps`, `ThinkingStep`, `ThinkingStepStatus` and
|
|
35
|
+
`ThinkingStepType` types alias `ActivityListProps`, `ActivityStep`, `ActivityStepStatus` and
|
|
36
|
+
`ActivityStepType`, respectively. The new types are exported from the package root and
|
|
37
|
+
`@gravity-ui/aikit/ActivityList`.
|
|
137
38
|
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
Expansion is not reset on updates. `prefers-reduced-motion` disables the text pulse.
|
|
39
|
+
`thinkingMessageToStep`, `groupThinkingMessages`, `ThinkingGroupEntry` and
|
|
40
|
+
`GroupThinkingMessagesOptions` keep their names and remain available from both subpaths.
|
|
141
41
|
|
|
142
42
|
## Styling
|
|
143
43
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
Long headings are truncated with a title tooltip; details wrap inside narrow containers.
|
|
44
|
+
CSS classes and the `--g-aikit-thinking-message-group-pulse-duration` custom property are
|
|
45
|
+
preserved. See [ActivityList styling](./ActivityList.md#styling).
|
|
@@ -1378,7 +1378,7 @@ The footer section contains:
|
|
|
1378
1378
|
Set `messageListConfig={{thinkingMessageView: 'grouped'}}` to opt in to compact thinking history
|
|
1379
1379
|
without changing existing message data. Merge this property with your existing config.
|
|
1380
1380
|
Adjacent thinking parts inside one assistant message are grouped; custom thinking renderers
|
|
1381
|
-
take precedence. See [
|
|
1381
|
+
take precedence. See [ActivityList](../organisms/ActivityList.md)
|
|
1382
1382
|
for migration and explicit cross-message grouping.
|
|
1383
1383
|
|
|
1384
1384
|
### Markdown export
|
|
@@ -52,21 +52,22 @@ Experimental entries use `@gravity-ui/aikit/experimental`; see [the compatibilit
|
|
|
52
52
|
| [ToolStatus](../components/molecules/ToolStatus.md) | Tool-status indicator with localized text. |
|
|
53
53
|
| [ChangedFilesSummary](../components/molecules/ChangedFilesSummary.md) | **Experimental.** Changed-files pill/card with baseline DiffStat and an accessible file list. |
|
|
54
54
|
|
|
55
|
-
## Organisms (
|
|
55
|
+
## Organisms (12)
|
|
56
56
|
|
|
57
|
-
| Component | Description
|
|
58
|
-
| ---------------------------------------------------------------------------------- |
|
|
59
|
-
| [AssistantMessage](../components/organisms/AssistantMessage.md) | Assistant message with multi-part content and custom renderers.
|
|
60
|
-
| [AttachmentPicker](../components/organisms/AttachmentPicker.md) | Paperclip button that opens the file upload dialog.
|
|
61
|
-
| [FileUploadDialog](../components/organisms/FileUploadDialog.md) | Dialog with drag-and-drop and queued/uploaded files list.
|
|
62
|
-
| [Header](../components/organisms/Header.md) | Chat header with navigation and actions.
|
|
63
|
-
| [MessageList](../components/organisms/MessageList.md) | Message list with custom renderer registry support.
|
|
64
|
-
| [PromptInput](../components/organisms/PromptInput.md) | Flexible chat input — simple/full views, panels, suggestions, attachments.
|
|
65
|
-
| [ThinkingMessage](../components/organisms/ThinkingMessage.md) | AI thinking process with collapsible content and status.
|
|
66
|
-
| [
|
|
67
|
-
| [
|
|
68
|
-
| [
|
|
69
|
-
| [
|
|
57
|
+
| Component | Description |
|
|
58
|
+
| ---------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------- |
|
|
59
|
+
| [AssistantMessage](../components/organisms/AssistantMessage.md) | Assistant message with multi-part content and custom renderers. |
|
|
60
|
+
| [AttachmentPicker](../components/organisms/AttachmentPicker.md) | Paperclip button that opens the file upload dialog. |
|
|
61
|
+
| [FileUploadDialog](../components/organisms/FileUploadDialog.md) | Dialog with drag-and-drop and queued/uploaded files list. |
|
|
62
|
+
| [Header](../components/organisms/Header.md) | Chat header with navigation and actions. |
|
|
63
|
+
| [MessageList](../components/organisms/MessageList.md) | Message list with custom renderer registry support. |
|
|
64
|
+
| [PromptInput](../components/organisms/PromptInput.md) | Flexible chat input — simple/full views, panels, suggestions, attachments. |
|
|
65
|
+
| [ThinkingMessage](../components/organisms/ThinkingMessage.md) | AI thinking process with collapsible content and status. |
|
|
66
|
+
| [ActivityList](../components/organisms/ActivityList.md) | Compact progress and expandable activity history with thinking message migration helpers. |
|
|
67
|
+
| [ThinkingMessageGroup](../components/organisms/ThinkingMessageGroup.md) | Deprecated compatibility alias for ActivityList. |
|
|
68
|
+
| [ToolMessage](../components/organisms/ToolMessage.md) | Tool message with automatic expand/collapse and status behavior. |
|
|
69
|
+
| [UserMessage](../components/organisms/UserMessage.md) | User message renderer. |
|
|
70
|
+
| [RunActivity](../components/organisms/RunActivity.md) | **Experimental.** Ordered activity history with explicit lifecycle and compact steps. |
|
|
70
71
|
|
|
71
72
|
## Templates (4)
|
|
72
73
|
|
|
@@ -48,10 +48,11 @@ aikit/
|
|
|
48
48
|
│ │ │ ├── StarRating/ Suggestions/ Tabs/
|
|
49
49
|
│ │ │ ├── ToolFooter/ ToolHeader/ ToolStatus/
|
|
50
50
|
│ │ │
|
|
51
|
-
│ │ ├── organisms/ #
|
|
51
|
+
│ │ ├── organisms/ # 12 organisms
|
|
52
52
|
│ │ │ ├── AssistantMessage/ AttachmentPicker/
|
|
53
53
|
│ │ │ ├── FileUploadDialog/ Header/ MessageList/
|
|
54
|
-
│ │ │ ├── PromptInput/
|
|
54
|
+
│ │ │ ├── ActivityList/ PromptInput/ ThinkingMessage/
|
|
55
|
+
│ │ │ ├── ThinkingMessageGroup/ Deprecated ActivityList alias
|
|
55
56
|
│ │ │ ├── RunActivity/ ToolMessage/ UserMessage/
|
|
56
57
|
│ │ │
|
|
57
58
|
│ │ ├── templates/ # 4 templates
|
|
@@ -6,8 +6,9 @@
|
|
|
6
6
|
gap: var(--g-spacing-3);
|
|
7
7
|
padding: 0;
|
|
8
8
|
border: 0;
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
color: var(--g-color-text-secondary);
|
|
10
|
+
font-size: var(--g-text-body-1-font-size);
|
|
11
|
+
line-height: var(--g-text-body-1-line-height);
|
|
11
12
|
}
|
|
12
13
|
.g-aikit-thinking-message-group__compact-toggle {
|
|
13
14
|
align-self: flex-start;
|
|
@@ -18,8 +19,8 @@
|
|
|
18
19
|
text-align: start;
|
|
19
20
|
line-height: inherit;
|
|
20
21
|
--g-button-padding: 0;
|
|
21
|
-
--g-button-font-size: var(--g-text-body-
|
|
22
|
-
--g-button-text-color: var(--g-color-text-
|
|
22
|
+
--g-button-font-size: var(--g-text-body-1-font-size);
|
|
23
|
+
--g-button-text-color: var(--g-color-text-primary);
|
|
23
24
|
--g-button-text-color-hover: var(--g-color-text-primary);
|
|
24
25
|
--g-button-background-color-hover: transparent;
|
|
25
26
|
}
|
|
@@ -30,8 +31,8 @@
|
|
|
30
31
|
gap: calc(var(--g-spacing-1) / 2);
|
|
31
32
|
min-width: 0;
|
|
32
33
|
max-width: 100%;
|
|
33
|
-
color: var(--g-color-text-
|
|
34
|
-
line-height: var(--g-text-body-
|
|
34
|
+
color: var(--g-color-text-primary);
|
|
35
|
+
line-height: var(--g-text-body-1-line-height);
|
|
35
36
|
}
|
|
36
37
|
.g-aikit-thinking-message-group__compact-header, .g-aikit-thinking-message-group__compact-current {
|
|
37
38
|
display: flex;
|
|
@@ -109,7 +110,7 @@
|
|
|
109
110
|
justify-content: center;
|
|
110
111
|
align-items: center;
|
|
111
112
|
width: 16px;
|
|
112
|
-
height: var(--g-text-body-
|
|
113
|
+
height: var(--g-text-body-1-line-height);
|
|
113
114
|
color: var(--g-color-text-secondary);
|
|
114
115
|
}
|
|
115
116
|
.g-aikit-thinking-message-group__step-marker_status_error {
|
|
@@ -131,12 +132,10 @@
|
|
|
131
132
|
gap: var(--g-spacing-1);
|
|
132
133
|
}
|
|
133
134
|
.g-aikit-thinking-message-group__step-title {
|
|
134
|
-
color: var(--g-color-text-complementary);
|
|
135
|
-
font-size: var(--g-text-body-2-font-size);
|
|
136
|
-
line-height: var(--g-text-body-2-line-height);
|
|
137
|
-
}
|
|
138
|
-
.g-aikit-thinking-message-group__step-title_active {
|
|
139
135
|
color: var(--g-color-text-primary);
|
|
136
|
+
font-size: var(--g-text-body-1-font-size);
|
|
137
|
+
line-height: var(--g-text-body-1-line-height);
|
|
138
|
+
font-weight: var(--g-text-body-accent-font-weight);
|
|
140
139
|
}
|
|
141
140
|
.g-aikit-thinking-message-group__step-meta {
|
|
142
141
|
display: flex;
|
|
@@ -167,14 +166,47 @@
|
|
|
167
166
|
overflow-x: auto;
|
|
168
167
|
color: var(--g-color-text-secondary);
|
|
169
168
|
font-size: var(--g-text-body-1-font-size);
|
|
170
|
-
line-height: var(--g-text-body-
|
|
169
|
+
line-height: var(--g-text-body-1-line-height);
|
|
171
170
|
--yfm-font-size: var(--g-text-body-1-font-size);
|
|
172
|
-
--yfm-font-line-height: var(--g-text-body-
|
|
171
|
+
--yfm-font-line-height: var(--g-text-body-1-line-height);
|
|
173
172
|
}
|
|
174
173
|
.g-aikit-thinking-message-group__step-content_plain {
|
|
175
174
|
white-space: pre-wrap;
|
|
176
175
|
}
|
|
177
176
|
|
|
177
|
+
.g-aikit-thinking-message-group_without-icons .g-aikit-thinking-message-group__step {
|
|
178
|
+
grid-template-columns: minmax(0, 1fr);
|
|
179
|
+
}
|
|
180
|
+
.g-aikit-thinking-message-group_without-icons .g-aikit-thinking-message-group__step::before {
|
|
181
|
+
display: none;
|
|
182
|
+
}
|
|
183
|
+
.g-aikit-thinking-message-group_without-icons .g-aikit-thinking-message-group__step-marker_hidden {
|
|
184
|
+
position: absolute;
|
|
185
|
+
width: 1px;
|
|
186
|
+
height: 1px;
|
|
187
|
+
padding: 0;
|
|
188
|
+
margin: -1px;
|
|
189
|
+
overflow: hidden;
|
|
190
|
+
clip-path: inset(50%);
|
|
191
|
+
white-space: nowrap;
|
|
192
|
+
border: 0;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
.g-aikit-thinking-message-group .g-aikit-thinking-message-group__step-details .g-aikit-thinking-message-group__step-content {
|
|
196
|
+
--yfm-font-size: var(--g-text-body-1-font-size);
|
|
197
|
+
--yfm-font-line-height: var(--g-text-body-1-line-height);
|
|
198
|
+
--yfm-color-text: var(--g-color-text-secondary);
|
|
199
|
+
--yfm-font-size-h4: var(--g-text-body-1-font-size);
|
|
200
|
+
--yfm-font-line-height-h4: var(--g-text-body-1-line-height);
|
|
201
|
+
--yfm-font-size-h5: var(--g-text-body-1-font-size);
|
|
202
|
+
--yfm-font-line-height-h5: var(--g-text-body-1-line-height);
|
|
203
|
+
--yfm-font-size-h6: var(--g-text-body-1-font-size);
|
|
204
|
+
--yfm-font-line-height-h6: var(--g-text-body-1-line-height);
|
|
205
|
+
color: var(--g-color-text-secondary);
|
|
206
|
+
font-size: var(--g-text-body-1-font-size);
|
|
207
|
+
line-height: var(--g-text-body-1-line-height);
|
|
208
|
+
}
|
|
209
|
+
|
|
178
210
|
@keyframes thinking-message-group-pulse {
|
|
179
211
|
0%, 100% {
|
|
180
212
|
opacity: 1;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useId, useState } from 'react';
|
|
4
|
+
import { Copy } from '@gravity-ui/icons';
|
|
5
|
+
import { Button, Icon, Text } from '@gravity-ui/uikit';
|
|
6
|
+
import { MarkdownContent } from "../../../markdown/MarkdownProvider.js";
|
|
7
|
+
import { copyToClipboard } from "../../../utils/clipboardUtils.js";
|
|
8
|
+
import { block } from "../../../utils/cn.js";
|
|
9
|
+
import { ActionButton } from "../../atoms/ActionButton/index.js";
|
|
10
|
+
import { CompactHeading } from "./CompactHeading.js";
|
|
11
|
+
import { StepIcon } from "./StepIcon.js";
|
|
12
|
+
import { i18n } from "./i18n/index.js";
|
|
13
|
+
import "./ActivityList.css";
|
|
14
|
+
const b = block('thinking-message-group');
|
|
15
|
+
function shouldShowStatus(step, iconMode, hasContent) {
|
|
16
|
+
if (iconMode !== 'none')
|
|
17
|
+
return false;
|
|
18
|
+
const isEmpty = !step.title && !hasContent;
|
|
19
|
+
return isEmpty || (step.status !== 'thinking' && step.status !== 'thought');
|
|
20
|
+
}
|
|
21
|
+
export function ActivityList(props) {
|
|
22
|
+
var _a, _b;
|
|
23
|
+
const { t } = i18n.useTranslation();
|
|
24
|
+
const { steps, iconMode, activeStepLabel, stepTypes, status = (_b = (_a = steps[steps.length - 1]) === null || _a === void 0 ? void 0 : _a.status) !== null && _b !== void 0 ? _b : 'thought', activeStepId, expanded, defaultExpanded = false, maxHistoryHeight = 480, onExpandedChange, renderSummary, renderStepContent, className, qa, style, format = 'plain', transformOptions, mermaidOptions, openMarkdownLinksInNewTab, mdxOptions, mdxContext, markdownExtraProps, } = props;
|
|
25
|
+
const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);
|
|
26
|
+
const detailsId = useId();
|
|
27
|
+
const headingId = `${detailsId}-heading`;
|
|
28
|
+
const isExpanded = expanded !== null && expanded !== void 0 ? expanded : internalExpanded;
|
|
29
|
+
const activeStep = activeStepId === undefined
|
|
30
|
+
? [...steps].reverse().find((step) => step.status === 'thinking')
|
|
31
|
+
: steps.find((step) => step.id === activeStepId);
|
|
32
|
+
const completedSteps = steps.filter((step) => step.status === 'thought');
|
|
33
|
+
const isThinking = status === 'thinking';
|
|
34
|
+
const hasDetails = !isThinking ||
|
|
35
|
+
steps.length > 1 ||
|
|
36
|
+
Boolean(activeStepLabel && (activeStep === null || activeStep === void 0 ? void 0 : activeStep.title) && activeStepLabel !== activeStep.title) ||
|
|
37
|
+
Boolean(renderStepContent) ||
|
|
38
|
+
steps.some((step) => {
|
|
39
|
+
var _a;
|
|
40
|
+
const content = Array.isArray(step.content) ? step.content : [step.content];
|
|
41
|
+
return (Boolean(((_a = stepTypes === null || stepTypes === void 0 ? void 0 : stepTypes[step.type]) === null || _a === void 0 ? void 0 : _a.label) || step.enabledCopy || step.onCopyClick) ||
|
|
42
|
+
content.some(Boolean));
|
|
43
|
+
});
|
|
44
|
+
if (steps.length === 0) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const toggleExpanded = () => {
|
|
48
|
+
const nextExpanded = !isExpanded;
|
|
49
|
+
if (expanded === undefined) {
|
|
50
|
+
setInternalExpanded(nextExpanded);
|
|
51
|
+
}
|
|
52
|
+
onExpandedChange === null || onExpandedChange === void 0 ? void 0 : onExpandedChange(nextExpanded);
|
|
53
|
+
};
|
|
54
|
+
const defaultSummary = completedSteps.length > 0 ? t('completed-steps', { count: completedSteps.length }) : null;
|
|
55
|
+
const summary = renderSummary ? renderSummary(completedSteps) : defaultSummary;
|
|
56
|
+
const heading = (_jsx(CompactHeading, { activeStep: activeStep, stepTypes: stepTypes, iconMode: iconMode, activeStepLabel: activeStepLabel, status: status, summary: summary, hasDetails: hasDetails, isExpanded: isExpanded }));
|
|
57
|
+
return (_jsxs("div", { className: b({ 'without-icons': iconMode === 'none' }, className), "data-qa": qa, style: style, children: [hasDetails ? (_jsx(Button, { id: headingId, className: b('compact-toggle'), view: "flat-secondary", width: "auto", onClick: toggleExpanded, "aria-expanded": isExpanded, "aria-controls": isExpanded ? detailsId : undefined, children: heading })) : (_jsx("div", { className: b('compact-header'), children: heading })), hasDetails && isExpanded && (_jsx("ol", { className: b('steps'), id: detailsId, "aria-labelledby": headingId, tabIndex: 0, style: { maxHeight: maxHistoryHeight }, children: steps.map((step) => {
|
|
58
|
+
const type = stepTypes === null || stepTypes === void 0 ? void 0 : stepTypes[step.type];
|
|
59
|
+
const typeLabel = type === null || type === void 0 ? void 0 : type.label;
|
|
60
|
+
const content = Array.isArray(step.content) ? step.content : [step.content];
|
|
61
|
+
const hasContent = Boolean(renderStepContent) || content.some(Boolean);
|
|
62
|
+
const showStatus = shouldShowStatus(step, iconMode, hasContent);
|
|
63
|
+
return (_jsxs("li", { className: b('step'), children: [_jsx("span", { className: b('step-marker', {
|
|
64
|
+
status: step.status,
|
|
65
|
+
hidden: iconMode === 'none',
|
|
66
|
+
}), role: "img", "aria-label": t(`status-${step.status}`), children: _jsx(StepIcon, { status: step.status, operationIcon: type === null || type === void 0 ? void 0 : type.icon, iconMode: iconMode }) }), _jsxs("div", { className: b('step-body'), children: [step.title && (_jsx(Text, { variant: "body-1", className: b('step-title'), children: step.title })), (typeLabel || showStatus) && (_jsxs("span", { className: b('step-meta'), children: [typeLabel && _jsx("span", { children: typeLabel }), showStatus && (_jsx("span", { className: b('step-status', {
|
|
67
|
+
error: step.status === 'error',
|
|
68
|
+
}), children: t(`status-${step.status}`) }))] })), _jsx("div", { className: b('step-details'), children: renderStepContent
|
|
69
|
+
? renderStepContent(step)
|
|
70
|
+
: content.map((item, index) => {
|
|
71
|
+
if (!item) {
|
|
72
|
+
return null;
|
|
73
|
+
}
|
|
74
|
+
if (format === 'markdown') {
|
|
75
|
+
return (_jsx(MarkdownContent, { className: b('step-content'), content: item, transformOptions: Object.assign({ disableCommonAnchors: true }, transformOptions), mermaidOptions: mermaidOptions, openLinksInNewTab: openMarkdownLinksInNewTab, mdxOptions: mdxOptions, mdxContext: mdxContext, extraProps: markdownExtraProps }, index));
|
|
76
|
+
}
|
|
77
|
+
return (_jsx(Text, { className: b('step-content', {
|
|
78
|
+
plain: true,
|
|
79
|
+
}), children: item }, index));
|
|
80
|
+
}) }), step.status !== 'thinking' &&
|
|
81
|
+
(step.enabledCopy || step.onCopyClick) && (_jsx(ActionButton, { size: "xs", "aria-label": t('copy'), tooltipTitle: t('copy'), className: b('copy'), onClick: () => {
|
|
82
|
+
var _a;
|
|
83
|
+
if (step.onCopyClick)
|
|
84
|
+
step.onCopyClick();
|
|
85
|
+
else
|
|
86
|
+
copyToClipboard((_a = step.content) !== null && _a !== void 0 ? _a : '');
|
|
87
|
+
}, children: _jsx(Icon, { data: Copy, size: 14 }) }))] })] }, step.id));
|
|
88
|
+
}) }))] }));
|
|
89
|
+
}
|
|
90
|
+
//# sourceMappingURL=ActivityList.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ActivityList.js","sourceRoot":"../../../../../src","sources":["components/organisms/ActivityList/ActivityList.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAC,KAAK,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAEtC,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AACvC,OAAO,EAAC,MAAM,EAAE,IAAI,EAAE,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAErD,OAAO,EAAC,eAAe,EAAC,8CAA2C;AACnE,OAAO,EAAC,eAAe,EAAC,yCAAsC;AAC9D,OAAO,EAAC,KAAK,EAAC,6BAA0B;AACxC,OAAO,EAAC,YAAY,EAAC,0CAAiC;AAEtD,OAAO,EAAC,cAAc,EAAC,4BAAyB;AAChD,OAAO,EAAC,QAAQ,EAAC,sBAAmB;AACpC,OAAO,EAAC,IAAI,EAAC,wBAAe;AAG5B,4BAA6B;AAE7B,MAAM,CAAC,GAAG,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAE1C,SAAS,gBAAgB,CACrB,IAAkB,EAClB,QAAuC,EACvC,UAAmB;IAEnB,IAAI,QAAQ,KAAK,MAAM;QAAE,OAAO,KAAK,CAAC;IACtC,MAAM,OAAO,GAAG,CAAC,IAAI,CAAC,KAAK,IAAI,CAAC,UAAU,CAAC;IAC3C,OAAO,OAAO,IAAI,CAAC,IAAI,CAAC,MAAM,KAAK,UAAU,IAAI,IAAI,CAAC,MAAM,KAAK,SAAS,CAAC,CAAC;AAChF,CAAC;AAED,MAAM,UAAU,YAAY,CAAC,KAAwB;;IACjD,MAAM,EAAC,CAAC,EAAC,GAAG,IAAI,CAAC,cAAc,EAA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AAI,CAAC,OAAO,mCAAI,EAAE,CAAC,CAAC;wCAC7C,CAAC,YAED,KAAC,IAAI,IAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,GAAI,GACnB,CAClB,IACH,KAzFqB,IAAI,CAAC,EAAE,CA0FjC,CACR,CAAC;gBACN,CAAC,CAAC,GACD,CACR,IACC,CACT,CAAC;AACN,CAAC","sourcesContent":["'use client';\n\nimport {useId, useState} from 'react';\n\nimport {Copy} from '@gravity-ui/icons';\nimport {Button, Icon, Text} from '@gravity-ui/uikit';\n\nimport {MarkdownContent} from '../../../markdown/MarkdownProvider';\nimport {copyToClipboard} from '../../../utils/clipboardUtils';\nimport {block} from '../../../utils/cn';\nimport {ActionButton} from '../../atoms/ActionButton';\n\nimport {CompactHeading} from './CompactHeading';\nimport {StepIcon} from './StepIcon';\nimport {i18n} from './i18n';\nimport type {ActivityListProps, ActivityStep} from './types';\n\nimport './ActivityList.scss';\n\nconst b = block('thinking-message-group');\n\nfunction shouldShowStatus(\n step: ActivityStep,\n iconMode: ActivityListProps['iconMode'],\n hasContent: boolean,\n) {\n if (iconMode !== 'none') return false;\n const isEmpty = !step.title && !hasContent;\n return isEmpty || (step.status !== 'thinking' && step.status !== 'thought');\n}\n\nexport function ActivityList(props: ActivityListProps) {\n const {t} = i18n.useTranslation();\n const {\n steps,\n iconMode,\n activeStepLabel,\n stepTypes,\n status = steps[steps.length - 1]?.status ?? 'thought',\n activeStepId,\n expanded,\n defaultExpanded = false,\n maxHistoryHeight = 480,\n onExpandedChange,\n renderSummary,\n renderStepContent,\n className,\n qa,\n style,\n format = 'plain',\n transformOptions,\n mermaidOptions,\n openMarkdownLinksInNewTab,\n mdxOptions,\n mdxContext,\n markdownExtraProps,\n } = props;\n const [internalExpanded, setInternalExpanded] = useState(defaultExpanded);\n const detailsId = useId();\n const headingId = `${detailsId}-heading`;\n const isExpanded = expanded ?? internalExpanded;\n const activeStep =\n activeStepId === undefined\n ? [...steps].reverse().find((step) => step.status === 'thinking')\n : steps.find((step) => step.id === activeStepId);\n const completedSteps = steps.filter((step) => step.status === 'thought');\n const isThinking = status === 'thinking';\n const hasDetails =\n !isThinking ||\n steps.length > 1 ||\n Boolean(activeStepLabel && activeStep?.title && activeStepLabel !== activeStep.title) ||\n Boolean(renderStepContent) ||\n steps.some((step) => {\n const content = Array.isArray(step.content) ? step.content : [step.content];\n return (\n Boolean(stepTypes?.[step.type]?.label || step.enabledCopy || step.onCopyClick) ||\n content.some(Boolean)\n );\n });\n\n if (steps.length === 0) {\n return null;\n }\n\n const toggleExpanded = () => {\n const nextExpanded = !isExpanded;\n if (expanded === undefined) {\n setInternalExpanded(nextExpanded);\n }\n onExpandedChange?.(nextExpanded);\n };\n\n const defaultSummary =\n completedSteps.length > 0 ? t('completed-steps', {count: completedSteps.length}) : null;\n const summary = renderSummary ? renderSummary(completedSteps) : defaultSummary;\n const heading = (\n <CompactHeading\n activeStep={activeStep}\n stepTypes={stepTypes}\n iconMode={iconMode}\n activeStepLabel={activeStepLabel}\n status={status}\n summary={summary}\n hasDetails={hasDetails}\n isExpanded={isExpanded}\n />\n );\n\n return (\n <div\n className={b({'without-icons': iconMode === 'none'}, className)}\n data-qa={qa}\n style={style}\n >\n {hasDetails ? (\n <Button\n id={headingId}\n className={b('compact-toggle')}\n view=\"flat-secondary\"\n width=\"auto\"\n onClick={toggleExpanded}\n aria-expanded={isExpanded}\n aria-controls={isExpanded ? detailsId : undefined}\n >\n {heading}\n </Button>\n ) : (\n <div className={b('compact-header')}>{heading}</div>\n )}\n {hasDetails && isExpanded && (\n <ol\n className={b('steps')}\n id={detailsId}\n aria-labelledby={headingId}\n tabIndex={0}\n style={{maxHeight: maxHistoryHeight}}\n >\n {steps.map((step) => {\n const type = stepTypes?.[step.type];\n const typeLabel = type?.label;\n const content = Array.isArray(step.content) ? step.content : [step.content];\n const hasContent = Boolean(renderStepContent) || content.some(Boolean);\n const showStatus = shouldShowStatus(step, iconMode, hasContent);\n return (\n <li className={b('step')} key={step.id}>\n <span\n className={b('step-marker', {\n status: step.status,\n hidden: iconMode === 'none',\n })}\n role=\"img\"\n aria-label={t(`status-${step.status}`)}\n >\n <StepIcon\n status={step.status}\n operationIcon={type?.icon}\n iconMode={iconMode}\n />\n </span>\n <div className={b('step-body')}>\n {step.title && (\n <Text variant=\"body-1\" className={b('step-title')}>\n {step.title}\n </Text>\n )}\n {(typeLabel || showStatus) && (\n <span className={b('step-meta')}>\n {typeLabel && <span>{typeLabel}</span>}\n {showStatus && (\n <span\n className={b('step-status', {\n error: step.status === 'error',\n })}\n >\n {t(`status-${step.status}`)}\n </span>\n )}\n </span>\n )}\n <div className={b('step-details')}>\n {renderStepContent\n ? renderStepContent(step)\n : content.map((item, index) => {\n if (!item) {\n return null;\n }\n if (format === 'markdown') {\n return (\n <MarkdownContent\n className={b('step-content')}\n key={index}\n content={item}\n transformOptions={{\n disableCommonAnchors: true,\n ...transformOptions,\n }}\n mermaidOptions={mermaidOptions}\n openLinksInNewTab={\n openMarkdownLinksInNewTab\n }\n mdxOptions={mdxOptions}\n mdxContext={mdxContext}\n extraProps={markdownExtraProps}\n />\n );\n }\n return (\n <Text\n className={b('step-content', {\n plain: true,\n })}\n key={index}\n >\n {item}\n </Text>\n );\n })}\n </div>\n {step.status !== 'thinking' &&\n (step.enabledCopy || step.onCopyClick) && (\n <ActionButton\n size=\"xs\"\n aria-label={t('copy')}\n tooltipTitle={t('copy')}\n className={b('copy')}\n onClick={() => {\n if (step.onCopyClick) step.onCopyClick();\n else copyToClipboard(step.content ?? '');\n }}\n >\n <Icon data={Copy} size={14} />\n </ActionButton>\n )}\n </div>\n </li>\n );\n })}\n </ol>\n )}\n </div>\n );\n}\n"]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ActivityListProps, ActivityStep } from "./types.js";
|
|
3
|
+
interface CompactHeadingProps extends Pick<ActivityListProps, 'stepTypes' | 'iconMode' | 'activeStepLabel'> {
|
|
4
|
+
status: NonNullable<ActivityListProps['status']>;
|
|
5
|
+
activeStep?: ActivityStep;
|
|
6
|
+
summary: ReactNode;
|
|
7
|
+
hasDetails: boolean;
|
|
8
|
+
isExpanded: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function CompactHeading({ activeStep, stepTypes, iconMode, activeStepLabel, status, summary, hasDetails, isExpanded, }: CompactHeadingProps): import("react/jsx-runtime").JSX.Element;
|
|
11
|
+
export {};
|
package/build/esm/components/organisms/{ThinkingMessageGroup → ActivityList}/CompactHeading.js
RENAMED
|
@@ -5,19 +5,22 @@ import { block } from "../../../utils/cn.js";
|
|
|
5
5
|
import { StepIcon } from "./StepIcon.js";
|
|
6
6
|
import { i18n } from "./i18n/index.js";
|
|
7
7
|
const b = block('thinking-message-group');
|
|
8
|
-
export function CompactHeading({ activeStep, stepTypes, status, summary, hasDetails, isExpanded, }) {
|
|
8
|
+
export function CompactHeading({ activeStep, stepTypes, iconMode, activeStepLabel, status, summary, hasDetails, isExpanded, }) {
|
|
9
9
|
var _a;
|
|
10
10
|
const { t } = i18n.useTranslation();
|
|
11
11
|
const isThinking = status === 'thinking';
|
|
12
|
-
const showActiveStep = Boolean(activeStep && isThinking);
|
|
13
12
|
const hasSummary = summary !== null && summary !== undefined && summary !== false && summary !== '';
|
|
14
13
|
const showCompletedSummary = status === 'thought' && hasSummary;
|
|
15
|
-
const label = (
|
|
16
|
-
|
|
14
|
+
const label = (isThinking && activeStepLabel) ||
|
|
15
|
+
(isThinking && (activeStep === null || activeStep === void 0 ? void 0 : activeStep.title)) ||
|
|
16
|
+
t(`status-${status}`);
|
|
17
|
+
const showIcon = status !== 'thought' && iconMode !== 'none';
|
|
18
|
+
const operationIcon = isThinking && activeStep ? (_a = stepTypes === null || stepTypes === void 0 ? void 0 : stepTypes[activeStep.type]) === null || _a === void 0 ? void 0 : _a.icon : null;
|
|
17
19
|
const showSecondarySummary = !showCompletedSummary && hasSummary;
|
|
18
|
-
return (_jsxs("span", { className: b('compact-heading'), children: [_jsxs("span", { className: b('compact-current'), children: [
|
|
19
|
-
active: isThinking &&
|
|
20
|
+
return (_jsxs("span", { className: b('compact-heading'), children: [_jsxs("span", { className: b('compact-current'), children: [showIcon && (_jsx("span", { className: b('step-icon', { error: status === 'error' }), "aria-hidden": "true", children: _jsx(StepIcon, { status: status, operationIcon: operationIcon, iconMode: iconMode }) })), _jsx("span", { className: b('compact-label', {
|
|
21
|
+
active: isThinking &&
|
|
22
|
+
((activeStep === null || activeStep === void 0 ? void 0 : activeStep.status) === 'thinking' || Boolean(activeStepLabel)),
|
|
20
23
|
error: status === 'error',
|
|
21
|
-
}), title: showCompletedSummary ? undefined : label, children: showCompletedSummary ? summary : label }), hasDetails && (_jsx("span", { className: b('disclosure', { expanded: isExpanded }), "aria-hidden": "true", children: _jsx(Icon, { data: ChevronRight, size: 12 }) }))] }), showSecondarySummary && (_jsx("span", { className: b('compact-summary', { indented:
|
|
24
|
+
}), title: showCompletedSummary ? undefined : label, children: showCompletedSummary ? summary : label }), hasDetails && (_jsx("span", { className: b('disclosure', { expanded: isExpanded }), "aria-hidden": "true", children: _jsx(Icon, { data: ChevronRight, size: 12 }) }))] }), showSecondarySummary && (_jsx("span", { className: b('compact-summary', { indented: showIcon }), children: summary }))] }));
|
|
22
25
|
}
|
|
23
26
|
//# sourceMappingURL=CompactHeading.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"CompactHeading.js","sourceRoot":"../../../../../src","sources":["components/organisms/ActivityList/CompactHeading.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,YAAY,EAAC,MAAM,mBAAmB,CAAC;AAC/C,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAC,KAAK,EAAC,6BAA0B;AAExC,OAAO,EAAC,QAAQ,EAAC,sBAAmB;AACpC,OAAO,EAAC,IAAI,EAAC,wBAAe;AAG5B,MAAM,CAAC,GAAG,KAAK,CAAC,wBAAwB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Aa,EAC5B,QAAQ,EAAE,QAAQ,GACpB,GACC,CACV,EACD,eACI,SAAS,EAAE,CAAC,CAAC,eAAe,EAAE;4BAC1B,MAAM,EACF,UAAU;gCACV,CAAC,CAAA,UAAU,aAAV,UAAU,uBAAV,UAAU,CAAE,MAAM,MAAK,UAAU,IAAI,OAAO,CAAC,eAAe,CAAC,CAAC;4BACnE,KAAK,EAAE,MAAM,KAAK,OAAO;yBAC5B,CAAC,EACF,KAAK,EAAE,oBAAoB,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,KAAK,YAE9C,oBAAoB,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,KAAK,GACpC,EACN,UAAU,IAAI,CACX,eAAM,SAAS,EAAE,CAAC,CAAC,YAAY,EAAE,EAAC,QAAQ,EAAE,UAAU,EAAC,CAAC,iBAAc,MAAM,YACxE,KAAC,IAAI,IAAC,IAAI,EAAE,YAAY,EAAE,IAAI,EAAE,EAAE,GAAI,GACnC,CACV,IACE,EACN,oBAAoB,IAAI,CACrB,eAAM,SAAS,EAAE,CAAC,CAAC,iBAAiB,EAAE,EAAC,QAAQ,EAAE,QAAQ,EAAC,CAAC,YAAG,OAAO,GAAQ,CAChF,IACE,CACV,CAAC;AACN,CAAC","sourcesContent":["import type {ReactNode} from 'react';\n\nimport {ChevronRight} from '@gravity-ui/icons';\nimport {Icon} from '@gravity-ui/uikit';\n\nimport {block} from '../../../utils/cn';\n\nimport {StepIcon} from './StepIcon';\nimport {i18n} from './i18n';\nimport type {ActivityListProps, ActivityStep} from './types';\n\nconst b = block('thinking-message-group');\n\ninterface CompactHeadingProps\n extends Pick<ActivityListProps, 'stepTypes' | 'iconMode' | 'activeStepLabel'> {\n status: NonNullable<ActivityListProps['status']>;\n activeStep?: ActivityStep;\n summary: ReactNode;\n hasDetails: boolean;\n isExpanded: boolean;\n}\n\nexport function CompactHeading({\n activeStep,\n stepTypes,\n iconMode,\n activeStepLabel,\n status,\n summary,\n hasDetails,\n isExpanded,\n}: CompactHeadingProps) {\n const {t} = i18n.useTranslation();\n const isThinking = status === 'thinking';\n const hasSummary =\n summary !== null && summary !== undefined && summary !== false && summary !== '';\n const showCompletedSummary = status === 'thought' && hasSummary;\n const label =\n (isThinking && activeStepLabel) ||\n (isThinking && activeStep?.title) ||\n t(`status-${status}`);\n const showIcon = status !== 'thought' && iconMode !== 'none';\n const operationIcon = isThinking && activeStep ? stepTypes?.[activeStep.type]?.icon : null;\n const showSecondarySummary = !showCompletedSummary && hasSummary;\n return (\n <span className={b('compact-heading')}>\n <span className={b('compact-current')}>\n {showIcon && (\n <span\n className={b('step-icon', {error: status === 'error'})}\n aria-hidden=\"true\"\n >\n <StepIcon\n status={status}\n operationIcon={operationIcon}\n iconMode={iconMode}\n />\n </span>\n )}\n <span\n className={b('compact-label', {\n active:\n isThinking &&\n (activeStep?.status === 'thinking' || Boolean(activeStepLabel)),\n error: status === 'error',\n })}\n title={showCompletedSummary ? undefined : label}\n >\n {showCompletedSummary ? summary : label}\n </span>\n {hasDetails && (\n <span className={b('disclosure', {expanded: isExpanded})} aria-hidden=\"true\">\n <Icon data={ChevronRight} size={12} />\n </span>\n )}\n </span>\n {showSecondarySummary && (\n <span className={b('compact-summary', {indented: showIcon})}>{summary}</span>\n )}\n </span>\n );\n}\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import type { ReactNode } from 'react';
|
|
2
|
+
import type { ActivityListProps, ActivityStepStatus } from "./types.js";
|
|
3
|
+
export declare function StepIcon({ status, operationIcon, iconMode, }: {
|
|
4
|
+
status: ActivityStepStatus;
|
|
5
|
+
operationIcon?: ReactNode;
|
|
6
|
+
iconMode?: ActivityListProps['iconMode'];
|
|
7
|
+
}): string | number | true | Iterable<ReactNode> | import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Ban, Check, CircleXmark, Clock, Pause } from '@gravity-ui/icons';
|
|
3
|
+
import { Icon } from '@gravity-ui/uikit';
|
|
4
|
+
import { block } from "../../../utils/cn.js";
|
|
5
|
+
const b = block('thinking-message-group');
|
|
6
|
+
const statusIcons = {
|
|
7
|
+
thinking: Clock,
|
|
8
|
+
thought: Check,
|
|
9
|
+
error: CircleXmark,
|
|
10
|
+
cancelled: Ban,
|
|
11
|
+
paused: Pause,
|
|
12
|
+
};
|
|
13
|
+
export function StepIcon({ status, operationIcon, iconMode, }) {
|
|
14
|
+
if (iconMode === 'none') {
|
|
15
|
+
return null;
|
|
16
|
+
}
|
|
17
|
+
if (status === 'thinking' || status === 'thought') {
|
|
18
|
+
if (iconMode === 'type') {
|
|
19
|
+
return operationIcon || _jsx("span", { className: b('step-dot') });
|
|
20
|
+
}
|
|
21
|
+
if (iconMode === undefined && operationIcon) {
|
|
22
|
+
return operationIcon;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
return _jsx(Icon, { data: statusIcons[status], size: 16 });
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=StepIcon.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"StepIcon.js","sourceRoot":"../../../../../src","sources":["components/organisms/ActivityList/StepIcon.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,GAAG,EAAE,KAAK,EAAE,WAAW,EAAE,KAAK,EAAE,KAAK,EAAC,MAAM,mBAAmB,CAAC;AACxE,OAAO,EAAC,IAAI,EAAC,MAAM,mBAAmB,CAAC;AAEvC,OAAO,EAAC,KAAK,EAAC,6BAA0B;AAIxC,MAAM,CAAC,GAAG,KAAK,CAAC,wBAAwB,CAAC,CAAC;AAE1C,MAAM,WAAW,GAAG;IAChB,QAAQ,EAAE,KAAK;IACf,OAAO,EAAE,KAAK;IACd,KAAK,EAAE,WAAW;IAClB,SAAS,EAAE,GAAG;IACd,MAAM,EAAE,KAAK;CAChB,CAAC;AAEF,MAAM,UAAU,QAAQ,CAAC,EACrB,MAAM,EACN,aAAa,EACb,QAAQ,GAKX;IACG,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,IAAI,MAAM,KAAK,UAAU,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QAChD,IAAI,QAAQ,KAAK,MAAM,EAAE,CAAC;YACtB,OAAO,aAAa,IAAI,eAAM,SAAS,EAAE,CAAC,CAAC,UAAU,CAAC,GAAI,CAAC;QAC/D,CAAC;QACD,IAAI,QAAQ,KAAK,SAAS,IAAI,aAAa,EAAE,CAAC;YAC1C,OAAO,aAAa,CAAC;QACzB,CAAC;IACL,CAAC;IAED,OAAO,KAAC,IAAI,IAAC,IAAI,EAAE,WAAW,CAAC,MAAM,CAAC,EAAE,IAAI,EAAE,EAAE,GAAI,CAAC;AACzD,CAAC","sourcesContent":["import type {ReactNode} from 'react';\n\nimport {Ban, Check, CircleXmark, Clock, Pause} from '@gravity-ui/icons';\nimport {Icon} from '@gravity-ui/uikit';\n\nimport {block} from '../../../utils/cn';\n\nimport type {ActivityListProps, ActivityStepStatus} from './types';\n\nconst b = block('thinking-message-group');\n\nconst statusIcons = {\n thinking: Clock,\n thought: Check,\n error: CircleXmark,\n cancelled: Ban,\n paused: Pause,\n};\n\nexport function StepIcon({\n status,\n operationIcon,\n iconMode,\n}: {\n status: ActivityStepStatus;\n operationIcon?: ReactNode;\n iconMode?: ActivityListProps['iconMode'];\n}) {\n if (iconMode === 'none') {\n return null;\n }\n\n if (status === 'thinking' || status === 'thought') {\n if (iconMode === 'type') {\n return operationIcon || <span className={b('step-dot')} />;\n }\n if (iconMode === undefined && operationIcon) {\n return operationIcon;\n }\n }\n\n return <Icon data={statusIcons[status]} size={16} />;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"../../../../../../src","sources":["components/organisms/ActivityList/i18n/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,mBAAmB,EAAC,MAAM,wBAAwB,CAAC;AAE3D,OAAO,EAAC,SAAS,EAAC,gCAA6B;AAE/C,OAAO,EAAE,kBAAkB;AAC3B,OAAO,EAAE,kBAAkB;AAE3B,MAAM,CAAC,MAAM,IAAI,GAAG,mBAAmB,CAAC,EAAC,EAAE,EAAE,EAAE,EAAC,EAAE,GAAG,SAAS,sBAAsB,CAAC,CAAC","sourcesContent":["import {addComponentKeysets} from '@gravity-ui/uikit/i18n';\n\nimport {NAMESPACE} from '../../../../utils/cn';\n\nimport en from './en.json';\nimport ru from './ru.json';\n\nexport const i18n = addComponentKeysets({en, ru}, `${NAMESPACE}ThinkingMessageGroup`);\n"]}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const ActivityList: {
|
|
2
|
+
(props: import("./types.js").ActivityListProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
displayName: string;
|
|
4
|
+
};
|
|
5
|
+
export type { ActivityListProps, ActivityStep, ActivityStepStatus, ActivityStepType } from "./types.js";
|
|
6
|
+
export { thinkingMessageToStep, groupThinkingMessages } from "./utils.js";
|
|
7
|
+
export type { ThinkingGroupEntry, GroupThinkingMessagesOptions } from "./utils.js";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { withDefaultMarkdown } from "../../../markdown/withDefaultMarkdown.js";
|
|
3
|
+
import { ActivityList as ActivityListCore } from "./ActivityList.js";
|
|
4
|
+
export const ActivityList = withDefaultMarkdown(ActivityListCore);
|
|
5
|
+
export { thinkingMessageToStep, groupThinkingMessages } from "./utils.js";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|