@gravity-ui/aikit 1.7.0 → 1.9.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/README.md +0 -2
- package/dist/components/atoms/Alert/Alert.css +28 -0
- package/dist/components/atoms/Alert/index.js +1 -1
- package/dist/components/atoms/ChatDate/ChatDate.css +9 -0
- package/dist/components/atoms/ChatDate/ChatDate.js +1 -1
- package/dist/components/atoms/ContextIndicator/ContextIndicator.css +66 -0
- package/dist/components/atoms/ContextIndicator/index.js +1 -1
- package/dist/components/atoms/DiffStat/DiffStat.css +23 -0
- package/dist/components/atoms/DiffStat/index.js +1 -1
- package/dist/components/atoms/Disclaimer/Disclaimer.css +7 -0
- package/dist/components/atoms/Disclaimer/Disclaimer.js +1 -1
- package/dist/components/atoms/IntersectionContainer/IntersectionContainer.css +3 -0
- package/dist/components/atoms/IntersectionContainer/IntersectionContainer.js +1 -1
- package/dist/components/atoms/Loader/Loader.css +48 -0
- package/dist/components/atoms/Loader/Loader.js +1 -1
- package/dist/components/atoms/MarkdownRenderer/MarkdownRenderer.css +5 -0
- package/dist/components/atoms/MarkdownRenderer/MarkdownRenderer.js +1 -1
- package/dist/components/atoms/MessageBalloon/MessageBalloon.css +7 -0
- package/dist/components/atoms/MessageBalloon/index.js +1 -1
- package/dist/components/atoms/Shimmer/Shimmer.css +18 -0
- package/dist/components/atoms/Shimmer/index.js +1 -1
- package/dist/components/atoms/SubmitButton/SubmitButton.css +20 -0
- package/dist/components/atoms/SubmitButton/SubmitButton.js +1 -1
- package/dist/components/atoms/ToolIndicator/ToolIndicator.css +9 -0
- package/dist/components/atoms/ToolIndicator/index.js +1 -1
- package/dist/components/molecules/BaseMessage/BaseMessage.css +27 -0
- package/dist/components/molecules/BaseMessage/__stories__/BaseMessage.stories.d.ts +1 -0
- package/dist/components/molecules/BaseMessage/__stories__/BaseMessage.stories.js +10 -0
- package/dist/components/molecules/BaseMessage/index.js +22 -14
- package/dist/components/molecules/ButtonGroup/ButtonGroup.css +13 -0
- package/dist/components/molecules/ButtonGroup/index.js +1 -1
- package/dist/components/molecules/PromptInputBody/PromptInputBody.css +15 -0
- package/dist/components/molecules/PromptInputBody/PromptInputBody.js +1 -1
- package/dist/components/molecules/PromptInputFooter/PromptInputFooter.css +18 -0
- package/dist/components/molecules/PromptInputFooter/PromptInputFooter.js +1 -1
- package/dist/components/molecules/PromptInputHeader/PromptInputHeader.css +21 -0
- package/dist/components/molecules/PromptInputHeader/PromptInputHeader.js +1 -1
- package/dist/components/molecules/PromptInputPanel/PromptInputPanel.css +7 -0
- package/dist/components/molecules/PromptInputPanel/PromptInputPanel.js +1 -1
- package/dist/components/molecules/Suggestions/Suggestions.css +71 -0
- package/dist/components/molecules/Suggestions/Suggestions.js +1 -1
- package/dist/components/molecules/Tabs/Tabs.css +35 -0
- package/dist/components/molecules/Tabs/Tabs.js +1 -1
- package/dist/components/molecules/ToolFooter/ToolFooter.css +10 -0
- package/dist/components/molecules/ToolFooter/index.js +1 -1
- package/dist/components/molecules/ToolHeader/ToolHeader.css +18 -0
- package/dist/components/molecules/ToolHeader/index.js +1 -1
- package/dist/components/molecules/ToolStatus/ToolStatus.css +1 -0
- package/dist/components/molecules/ToolStatus/index.js +1 -1
- package/dist/components/organisms/AssistantMessage/AssistantMessage.css +6 -0
- package/dist/components/organisms/AssistantMessage/AssistantMessage.d.ts +2 -2
- package/dist/components/organisms/AssistantMessage/AssistantMessage.js +3 -3
- package/dist/components/organisms/AssistantMessage/__stories__/AssistantMessage.stories.d.ts +1 -0
- package/dist/components/organisms/AssistantMessage/__stories__/AssistantMessage.stories.js +12 -1
- package/dist/components/organisms/Header/Header.css +40 -0
- package/dist/components/organisms/Header/Header.js +1 -1
- package/dist/components/organisms/MessageList/MessageList.css +26 -0
- package/dist/components/organisms/MessageList/MessageList.js +2 -2
- package/dist/components/organisms/MessageList/__stories__/MessageList.stories.d.ts +1 -0
- package/dist/components/organisms/MessageList/__stories__/MessageList.stories.js +54 -4
- package/dist/components/organisms/PromptInput/PromptInput.css +50 -0
- package/dist/components/organisms/PromptInput/PromptInput.js +1 -1
- package/dist/components/organisms/ThinkingMessage/ThinkingMessage.css +20 -0
- package/dist/components/organisms/ThinkingMessage/index.js +1 -1
- package/dist/components/organisms/ToolMessage/ToolMessage.css +13 -0
- package/dist/components/organisms/ToolMessage/index.js +1 -1
- package/dist/components/organisms/UserMessage/UserMessage.css +10 -0
- package/dist/components/organisms/UserMessage/index.js +1 -1
- package/dist/components/pages/ChatContainer/ChatContainer.css +49 -0
- package/dist/components/pages/ChatContainer/ChatContainer.js +1 -1
- package/dist/components/pages/ChatContainer/__stories__/ChatContainer.stories.d.ts +5 -0
- package/dist/components/pages/ChatContainer/__stories__/ChatContainer.stories.js +77 -0
- package/dist/components/templates/ChatContent/ChatContent.css +23 -0
- package/dist/components/templates/ChatContent/ChatContent.js +1 -1
- package/dist/components/templates/EmptyContainer/EmptyContainer.css +64 -0
- package/dist/components/templates/EmptyContainer/EmptyContainer.js +1 -1
- package/dist/components/templates/History/History.css +81 -0
- package/dist/components/templates/History/HistoryList.js +1 -1
- package/dist/demo/ContentWrapper/ContentWrapper.css +6 -0
- package/dist/demo/ContentWrapper/ContentWrapper.js +1 -1
- package/dist/demo/DocsDecorator/DocsDecorator.css +87 -0
- package/dist/demo/Showcase/Showcase.css +34 -0
- package/dist/demo/Showcase/Showcase.js +1 -1
- package/dist/demo/ShowcaseItem/ShowcaseItem.css +7 -0
- package/dist/demo/ShowcaseItem/ShowcaseItem.js +1 -1
- package/dist/demo/SwapArea/SwapArea.css +11 -0
- package/dist/demo/SwapArea/SwapArea.js +1 -1
- package/dist/styles/variables.css +1 -0
- package/dist/types/messages.d.ts +3 -0
- package/package.json +6 -5
- package/dist/components/atoms/Alert/Alert.scss +0 -39
- package/dist/components/atoms/ChatDate/ChatDate.scss +0 -15
- package/dist/components/atoms/ContextIndicator/ContextIndicator.scss +0 -93
- package/dist/components/atoms/DiffStat/DiffStat.scss +0 -36
- package/dist/components/atoms/Disclaimer/Disclaimer.scss +0 -13
- package/dist/components/atoms/IntersectionContainer/IntersectionContainer.scss +0 -7
- package/dist/components/atoms/Loader/Loader.scss +0 -72
- package/dist/components/atoms/MarkdownRenderer/MarkdownRenderer.scss +0 -10
- package/dist/components/atoms/MessageBalloon/MessageBalloon.scss +0 -11
- package/dist/components/atoms/Shimmer/Shimmer.scss +0 -32
- package/dist/components/atoms/SubmitButton/SubmitButton.scss +0 -29
- package/dist/components/atoms/ToolIndicator/ToolIndicator.scss +0 -15
- package/dist/components/molecules/BaseMessage/BaseMessage.scss +0 -41
- package/dist/components/molecules/ButtonGroup/ButtonGroup.scss +0 -19
- package/dist/components/molecules/PromptInputBody/PromptInputBody.scss +0 -22
- package/dist/components/molecules/PromptInputFooter/PromptInputFooter.scss +0 -25
- package/dist/components/molecules/PromptInputHeader/PromptInputHeader.scss +0 -27
- package/dist/components/molecules/PromptInputPanel/PromptInputPanel.scss +0 -11
- package/dist/components/molecules/Suggestions/Suggestions.scss +0 -90
- package/dist/components/molecules/Tabs/Tabs.scss +0 -46
- package/dist/components/molecules/ToolFooter/ToolFooter.scss +0 -15
- package/dist/components/molecules/ToolHeader/ToolHeader.scss +0 -24
- package/dist/components/molecules/ToolStatus/ToolStatus.scss +0 -6
- package/dist/components/organisms/AssistantMessage/AssistantMessage.scss +0 -10
- package/dist/components/organisms/Header/Header.scss +0 -51
- package/dist/components/organisms/MessageList/MessageList.scss +0 -35
- package/dist/components/organisms/PromptInput/PromptInput.scss +0 -77
- package/dist/components/organisms/ThinkingMessage/ThinkingMessage.scss +0 -27
- package/dist/components/organisms/ToolMessage/ToolMessage.scss +0 -19
- package/dist/components/organisms/UserMessage/UserMessage.scss +0 -14
- package/dist/components/pages/ChatContainer/ChatContainer.scss +0 -60
- package/dist/components/templates/ChatContent/ChatContent.scss +0 -30
- package/dist/components/templates/EmptyContainer/EmptyContainer.scss +0 -86
- package/dist/components/templates/History/History.scss +0 -103
- package/dist/styles/_functions.scss +0 -5
- package/dist/styles/variables.scss +0 -1
- /package/dist/styles/{styles.scss → styles.css} +0 -0
package/README.md
CHANGED
|
@@ -185,10 +185,8 @@ If you're on Linux, you can run tests locally:
|
|
|
185
185
|
```bash
|
|
186
186
|
# Install Playwright browsers (run once)
|
|
187
187
|
npm run playwright:install
|
|
188
|
-
|
|
189
188
|
# Run all component tests
|
|
190
189
|
npm run playwright
|
|
191
|
-
|
|
192
190
|
# Update screenshot baselines
|
|
193
191
|
npm run playwright:update
|
|
194
192
|
```
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
.g-aikit-alert {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--g-spacing-2);
|
|
5
|
+
}
|
|
6
|
+
.g-aikit-alert__header {
|
|
7
|
+
display: flex;
|
|
8
|
+
align-items: center;
|
|
9
|
+
gap: var(--g-spacing-2);
|
|
10
|
+
}
|
|
11
|
+
.g-aikit-alert__text {
|
|
12
|
+
flex: 1;
|
|
13
|
+
}
|
|
14
|
+
.g-aikit-alert__icon {
|
|
15
|
+
flex-shrink: 0;
|
|
16
|
+
}
|
|
17
|
+
.g-aikit-alert__icon_variant_error {
|
|
18
|
+
color: var(--g-color-text-danger);
|
|
19
|
+
}
|
|
20
|
+
.g-aikit-alert__icon_variant_warning {
|
|
21
|
+
color: var(--g-color-text-warning-heavy);
|
|
22
|
+
}
|
|
23
|
+
.g-aikit-alert__icon_variant_info {
|
|
24
|
+
color: var(--g-color-text-info);
|
|
25
|
+
}
|
|
26
|
+
.g-aikit-alert__action {
|
|
27
|
+
margin-left: auto;
|
|
28
|
+
}
|
|
@@ -3,7 +3,7 @@ import { useMemo, useState } from 'react';
|
|
|
3
3
|
import { ChevronDown, ChevronUp, CircleExclamationFill, CircleInfoFill, TriangleExclamationFill, } from '@gravity-ui/icons';
|
|
4
4
|
import { Button, Icon, Text } from '@gravity-ui/uikit';
|
|
5
5
|
import { block } from '../../../utils/cn';
|
|
6
|
-
import './Alert.
|
|
6
|
+
import './Alert.css';
|
|
7
7
|
const b = block('alert');
|
|
8
8
|
const statusIcons = {
|
|
9
9
|
info: CircleInfoFill,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
.g-aikit-chat-date {
|
|
2
|
+
color: var(--g-color-text-secondary);
|
|
3
|
+
font-family: var(--g-text-body-font-family);
|
|
4
|
+
font-size: var(--g-text-body-1-font-size);
|
|
5
|
+
font-style: normal;
|
|
6
|
+
font-weight: var(--g-text-body-font-weight);
|
|
7
|
+
line-height: var(--g-text-body-1-line-height);
|
|
8
|
+
display: inline-block;
|
|
9
|
+
}
|
|
@@ -3,7 +3,7 @@ import { Fragment } from 'react';
|
|
|
3
3
|
import { useDateFormatter } from '../../../hooks';
|
|
4
4
|
import { block } from '../../../utils/cn';
|
|
5
5
|
import { i18n } from './i18n';
|
|
6
|
-
import './ChatDate.
|
|
6
|
+
import './ChatDate.css';
|
|
7
7
|
const b = block('chat-date');
|
|
8
8
|
/**
|
|
9
9
|
* ChatDate component displays formatted dates with optional time
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
.g-aikit-context-indicator__container {
|
|
2
|
+
display: inline-flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: center;
|
|
5
|
+
gap: 8px;
|
|
6
|
+
}
|
|
7
|
+
.g-aikit-context-indicator__container_orientation_horizontal {
|
|
8
|
+
flex-direction: row;
|
|
9
|
+
}
|
|
10
|
+
.g-aikit-context-indicator__container_orientation_horizontal.g-aikit-context-indicator__container_reversed {
|
|
11
|
+
flex-direction: row-reverse;
|
|
12
|
+
}
|
|
13
|
+
.g-aikit-context-indicator__container_orientation_vertical {
|
|
14
|
+
flex-direction: column;
|
|
15
|
+
}
|
|
16
|
+
.g-aikit-context-indicator__container_orientation_vertical.g-aikit-context-indicator__container_reversed {
|
|
17
|
+
flex-direction: column-reverse;
|
|
18
|
+
}
|
|
19
|
+
.g-aikit-context-indicator__progress {
|
|
20
|
+
--percentage: 0;
|
|
21
|
+
--progress-color: var(--g-aikit-ci-color-progress-1);
|
|
22
|
+
display: inline-flex;
|
|
23
|
+
align-items: center;
|
|
24
|
+
justify-content: center;
|
|
25
|
+
width: 16px;
|
|
26
|
+
height: 16px;
|
|
27
|
+
border-radius: 50%;
|
|
28
|
+
position: relative;
|
|
29
|
+
}
|
|
30
|
+
.g-aikit-context-indicator__progress::before {
|
|
31
|
+
content: "";
|
|
32
|
+
position: absolute;
|
|
33
|
+
inset: 0;
|
|
34
|
+
border-radius: 50%;
|
|
35
|
+
opacity: 0.3;
|
|
36
|
+
background: var(--progress-color);
|
|
37
|
+
opacity: 0.3;
|
|
38
|
+
}
|
|
39
|
+
.g-aikit-context-indicator__progress::after {
|
|
40
|
+
content: "";
|
|
41
|
+
position: absolute;
|
|
42
|
+
inset: 0;
|
|
43
|
+
border-radius: 50%;
|
|
44
|
+
opacity: 1;
|
|
45
|
+
background: conic-gradient(var(--progress-color) 0deg, var(--progress-color) calc(3.6deg * var(--percentage)), transparent calc(3.6deg * var(--percentage)), transparent 360deg);
|
|
46
|
+
}
|
|
47
|
+
.g-aikit-context-indicator__inner {
|
|
48
|
+
box-sizing: border-box;
|
|
49
|
+
width: calc(100% - 4px);
|
|
50
|
+
height: calc(100% - 4px);
|
|
51
|
+
border-radius: 50%;
|
|
52
|
+
background: var(--g-aikit-color-bg-primary);
|
|
53
|
+
position: relative;
|
|
54
|
+
z-index: 1;
|
|
55
|
+
}
|
|
56
|
+
.g-aikit-context-indicator__value {
|
|
57
|
+
color: var(--g-color-text-primary);
|
|
58
|
+
font-family: var(--g-text-body-font-family);
|
|
59
|
+
font-size: var(--g-text-body-1-font-size);
|
|
60
|
+
font-style: normal;
|
|
61
|
+
font-weight: var(--g-text-body-font-weight);
|
|
62
|
+
line-height: var(--g-text-body-1-line-height);
|
|
63
|
+
}
|
|
64
|
+
.g-aikit-context-indicator__value::after {
|
|
65
|
+
content: "%";
|
|
66
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { block } from '../../../utils/cn';
|
|
3
3
|
import { getProgressColor } from './utils';
|
|
4
|
-
import './ContextIndicator.
|
|
4
|
+
import './ContextIndicator.css';
|
|
5
5
|
const b = block('context-indicator');
|
|
6
6
|
export const ContextIndicator = (props) => {
|
|
7
7
|
const { className, qa, orientation = 'horizontal', reversed = false } = props;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
.g-aikit-diff-stat {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
gap: 4px;
|
|
5
|
+
color: var(--g-color-text-danger);
|
|
6
|
+
font-family: var(--g-text-code-font-family);
|
|
7
|
+
font-size: var(--g-text-code-inline-1);
|
|
8
|
+
font-style: normal;
|
|
9
|
+
font-weight: var(--g-text-code-font-weight);
|
|
10
|
+
line-height: var(--g-text-code-inline-1-line-height);
|
|
11
|
+
}
|
|
12
|
+
.g-aikit-diff-stat__added {
|
|
13
|
+
color: var(--g-color-text-positive-heavy);
|
|
14
|
+
}
|
|
15
|
+
.g-aikit-diff-stat__added_allow_sign::before {
|
|
16
|
+
content: "+";
|
|
17
|
+
}
|
|
18
|
+
.g-aikit-diff-stat__deleted {
|
|
19
|
+
color: var(--g-color-text-danger);
|
|
20
|
+
}
|
|
21
|
+
.g-aikit-diff-stat__deleted_allow_sign::before {
|
|
22
|
+
content: "-";
|
|
23
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { block } from '../../../utils/cn';
|
|
3
|
-
import './DiffStat.
|
|
3
|
+
import './DiffStat.css';
|
|
4
4
|
const b = block('diff-stat');
|
|
5
5
|
export const DiffStat = (props) => {
|
|
6
6
|
const { added, deleted, className, style, qa } = props;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Text } from '@gravity-ui/uikit';
|
|
3
3
|
import { block } from '../../../utils/cn';
|
|
4
|
-
import './Disclaimer.
|
|
4
|
+
import './Disclaimer.css';
|
|
5
5
|
const b = block('disclaimer');
|
|
6
6
|
/**
|
|
7
7
|
* Disclaimer component displays informational or warning messages
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import React from 'react';
|
|
3
3
|
import { useIntersection } from '@gravity-ui/uikit';
|
|
4
4
|
import { block } from '../../../utils/cn';
|
|
5
|
-
import './IntersectionContainer.
|
|
5
|
+
import './IntersectionContainer.css';
|
|
6
6
|
const b = block('intersection-container');
|
|
7
7
|
export const IntersectionContainer = ({ children, onIntersect, options, className, }) => {
|
|
8
8
|
const [ref, setRef] = React.useState(null);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
@keyframes pulse {
|
|
2
|
+
100% {
|
|
3
|
+
opacity: 0;
|
|
4
|
+
}
|
|
5
|
+
50% {
|
|
6
|
+
opacity: 70%;
|
|
7
|
+
}
|
|
8
|
+
0% {
|
|
9
|
+
opacity: 40%;
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
.g-aikit-loader {
|
|
13
|
+
display: inline-flex;
|
|
14
|
+
align-items: center;
|
|
15
|
+
gap: var(--g-spacing-1);
|
|
16
|
+
}
|
|
17
|
+
.g-aikit-loader__left, .g-aikit-loader__center, .g-aikit-loader__right {
|
|
18
|
+
background: var(--g-color-text-secondary);
|
|
19
|
+
border-radius: 50%;
|
|
20
|
+
animation: pulse ease 800ms infinite;
|
|
21
|
+
}
|
|
22
|
+
.g-aikit-loader_size_xs .g-aikit-loader__left,
|
|
23
|
+
.g-aikit-loader_size_xs .g-aikit-loader__center,
|
|
24
|
+
.g-aikit-loader_size_xs .g-aikit-loader__right {
|
|
25
|
+
width: 3px;
|
|
26
|
+
height: 3px;
|
|
27
|
+
}
|
|
28
|
+
.g-aikit-loader_size_s .g-aikit-loader__left,
|
|
29
|
+
.g-aikit-loader_size_s .g-aikit-loader__center,
|
|
30
|
+
.g-aikit-loader_size_s .g-aikit-loader__right {
|
|
31
|
+
width: 5px;
|
|
32
|
+
height: 5px;
|
|
33
|
+
}
|
|
34
|
+
.g-aikit-loader_size_m .g-aikit-loader__left,
|
|
35
|
+
.g-aikit-loader_size_m .g-aikit-loader__center,
|
|
36
|
+
.g-aikit-loader_size_m .g-aikit-loader__right {
|
|
37
|
+
width: 8px;
|
|
38
|
+
height: 8px;
|
|
39
|
+
}
|
|
40
|
+
.g-aikit-loader__left {
|
|
41
|
+
animation-delay: 200ms;
|
|
42
|
+
}
|
|
43
|
+
.g-aikit-loader__center {
|
|
44
|
+
animation-delay: 400ms;
|
|
45
|
+
}
|
|
46
|
+
.g-aikit-loader__right {
|
|
47
|
+
animation-delay: 600ms;
|
|
48
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Spin } from '@gravity-ui/uikit';
|
|
3
3
|
import { block } from '../../../utils/cn';
|
|
4
|
-
import './Loader.
|
|
4
|
+
import './Loader.css';
|
|
5
5
|
const b = block('loader');
|
|
6
6
|
export function Loader({ view = 'streaming', size = 's', className, qa }) {
|
|
7
7
|
if (view === 'streaming') {
|
|
@@ -4,7 +4,7 @@ import { useMarkdownTransform } from '../../../hooks/useMarkdownTransform';
|
|
|
4
4
|
import { useRemend } from '../../../hooks/useRemend';
|
|
5
5
|
import { block } from '../../../utils/cn';
|
|
6
6
|
import { areOptionsEqual } from '../../../utils/markdownUtils';
|
|
7
|
-
import './MarkdownRenderer.
|
|
7
|
+
import './MarkdownRenderer.css';
|
|
8
8
|
const b = block('markdown-renderer');
|
|
9
9
|
function MarkdownRendererComponent({ content, className, qa, transformOptions, shouldParseIncompleteMarkdown = false, }) {
|
|
10
10
|
const closedContent = useRemend(content, shouldParseIncompleteMarkdown);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { block } from '../../../utils/cn';
|
|
3
|
-
import './MessageBalloon.
|
|
3
|
+
import './MessageBalloon.css';
|
|
4
4
|
const b = block('message-balloon');
|
|
5
5
|
export const MessageBalloon = (props) => {
|
|
6
6
|
const { className, qa, children } = props;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.g-aikit-shimmer__container {
|
|
2
|
+
position: relative;
|
|
3
|
+
display: inline-block;
|
|
4
|
+
color: var(--g-aikit-text-primary, inherit);
|
|
5
|
+
mask-image: linear-gradient(90deg, var(--g-aikit-shimmer-color-from) 0%, var(--g-aikit-shimmer-color-from) 40%, var(--g-aikit-shimmer-color-to) 50%, var(--g-aikit-shimmer-color-from) 60%, var(--g-aikit-shimmer-color-from) 100%);
|
|
6
|
+
mask-size: var(--g-aikit-shimmer-gradient-size) 100%;
|
|
7
|
+
mask-clip: text;
|
|
8
|
+
animation: shimmer var(--g-aikit-shimmer-duration) infinite linear;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
@keyframes shimmer {
|
|
12
|
+
0% {
|
|
13
|
+
mask-position: 200% 50%;
|
|
14
|
+
}
|
|
15
|
+
100% {
|
|
16
|
+
mask-position: 0% 50%;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
.g-aikit-submit-button {
|
|
2
|
+
display: flex;
|
|
3
|
+
justify-content: center;
|
|
4
|
+
align-items: center;
|
|
5
|
+
}
|
|
6
|
+
.g-aikit-submit-button_size_s.g-aikit-submit-button_loading {
|
|
7
|
+
padding: 4px;
|
|
8
|
+
}
|
|
9
|
+
.g-aikit-submit-button_size_m.g-aikit-submit-button_loading {
|
|
10
|
+
padding: 6px;
|
|
11
|
+
}
|
|
12
|
+
.g-aikit-submit-button_size_l.g-aikit-submit-button_loading {
|
|
13
|
+
padding: 10px;
|
|
14
|
+
}
|
|
15
|
+
.g-aikit-submit-button__loader {
|
|
16
|
+
display: flex;
|
|
17
|
+
}
|
|
18
|
+
.g-aikit-submit-button__spinner {
|
|
19
|
+
--g-color-line-brand: var(--g-color-text-brand-contrast);
|
|
20
|
+
}
|
|
@@ -5,7 +5,7 @@ import { Icon, Spin } from '@gravity-ui/uikit';
|
|
|
5
5
|
import { block } from '../../../utils/cn';
|
|
6
6
|
import { ActionButton } from '../ActionButton';
|
|
7
7
|
import { i18n } from './i18n';
|
|
8
|
-
import './SubmitButton.
|
|
8
|
+
import './SubmitButton.css';
|
|
9
9
|
const b = block('submit-button');
|
|
10
10
|
/**
|
|
11
11
|
* Submit button component with state management through props
|
|
@@ -3,7 +3,7 @@ import { CircleCheck, CircleInfo, CircleXmark } from '@gravity-ui/icons';
|
|
|
3
3
|
import { Icon } from '@gravity-ui/uikit';
|
|
4
4
|
import { block } from '../../../utils/cn';
|
|
5
5
|
import { Loader } from '../Loader';
|
|
6
|
-
import './ToolIndicator.
|
|
6
|
+
import './ToolIndicator.css';
|
|
7
7
|
const b = block('tool-indicator');
|
|
8
8
|
export const ToolIndicator = (props) => {
|
|
9
9
|
const { status = 'info', className, qa } = props;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
.g-aikit-base-message {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
gap: var(--g-spacing-1);
|
|
5
|
+
word-break: break-word;
|
|
6
|
+
}
|
|
7
|
+
.g-aikit-base-message_variant_user {
|
|
8
|
+
align-items: flex-end;
|
|
9
|
+
max-width: 90%;
|
|
10
|
+
}
|
|
11
|
+
.g-aikit-base-message_variant_system, .g-aikit-base-message_variant_assistant {
|
|
12
|
+
align-items: flex-start;
|
|
13
|
+
}
|
|
14
|
+
.g-aikit-base-message_btn-hover .g-aikit-base-message__actions {
|
|
15
|
+
visibility: hidden;
|
|
16
|
+
}
|
|
17
|
+
.g-aikit-base-message_btn-hover:hover .g-aikit-base-message__actions {
|
|
18
|
+
visibility: visible;
|
|
19
|
+
}
|
|
20
|
+
.g-aikit-base-message__actions {
|
|
21
|
+
display: flex;
|
|
22
|
+
align-items: center;
|
|
23
|
+
gap: var(--g-spacing-3);
|
|
24
|
+
}
|
|
25
|
+
.g-aikit-base-message__actions_reverse {
|
|
26
|
+
flex-direction: row-reverse;
|
|
27
|
+
}
|
|
@@ -7,3 +7,4 @@ export declare const Variant: StoryObj<BaseMessageProps>;
|
|
|
7
7
|
export declare const ShowActionsOnHover: StoryFn<BaseMessageProps>;
|
|
8
8
|
export declare const ShowTimestamp: StoryObj<BaseMessageProps>;
|
|
9
9
|
export declare const WithCustomAction: StoryFn<BaseMessageProps>;
|
|
10
|
+
export declare const WithUserRating: StoryObj<BaseMessageProps>;
|
|
@@ -50,6 +50,12 @@ const buttons = [
|
|
|
50
50
|
// eslint-disable-next-line no-console
|
|
51
51
|
{ actionType: 'unlike', onClick: () => console.log('unlike') },
|
|
52
52
|
];
|
|
53
|
+
const likeUnlikeButtons = [
|
|
54
|
+
// eslint-disable-next-line no-console
|
|
55
|
+
{ actionType: 'like', onClick: () => console.log('like') },
|
|
56
|
+
// eslint-disable-next-line no-console
|
|
57
|
+
{ actionType: 'unlike', onClick: () => console.log('unlike') },
|
|
58
|
+
];
|
|
53
59
|
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(BaseMessage, Object.assign({}, args)) }));
|
|
54
60
|
Playground.args = {
|
|
55
61
|
children: 'My message',
|
|
@@ -75,3 +81,7 @@ export const WithCustomAction = (args) => (_jsx(ContentWrapper, { children: _jsx
|
|
|
75
81
|
// eslint-disable-next-line no-console
|
|
76
82
|
onClick: () => console.log('custom'), children: "Custom" }, "custom"),
|
|
77
83
|
], role: "assistant", children: 'Message with custom action button' })) }));
|
|
84
|
+
export const WithUserRating = {
|
|
85
|
+
render: (args) => (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "No rating", width: "300px", children: _jsx(BaseMessage, Object.assign({}, args, { actions: likeUnlikeButtons, role: "assistant", children: 'Message' })) }), _jsx(ShowcaseItem, { title: "Rated like", width: "300px", children: _jsx(BaseMessage, Object.assign({}, args, { actions: likeUnlikeButtons, role: "assistant", userRating: "like", children: 'Message' })) }), _jsx(ShowcaseItem, { title: "Rated dislike", width: "300px", children: _jsx(BaseMessage, Object.assign({}, args, { actions: likeUnlikeButtons, role: "assistant", userRating: "dislike", children: 'Message' })) })] })),
|
|
86
|
+
decorators: defaultDecorators,
|
|
87
|
+
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { ArrowRotateLeft, Copy as CopyIcon, Pencil, ThumbsDown, ThumbsUp, TrashBin, } from '@gravity-ui/icons';
|
|
3
|
+
import { ArrowRotateLeft, Copy as CopyIcon, Pencil, ThumbsDown, ThumbsDownFill, ThumbsUp, ThumbsUpFill, TrashBin, } from '@gravity-ui/icons';
|
|
4
4
|
import { Icon } from '@gravity-ui/uikit';
|
|
5
5
|
import { isActionConfig } from '../../../utils/actionUtils';
|
|
6
6
|
import { block } from '../../../utils/cn';
|
|
@@ -8,7 +8,7 @@ import { ActionButton } from '../../atoms';
|
|
|
8
8
|
import { ChatDate } from '../../atoms/ChatDate';
|
|
9
9
|
import { ButtonGroup } from '../ButtonGroup';
|
|
10
10
|
import { i18n } from './i18n';
|
|
11
|
-
import './BaseMessage.
|
|
11
|
+
import './BaseMessage.css';
|
|
12
12
|
const b = block('base-message');
|
|
13
13
|
export var BaseMessageActionType;
|
|
14
14
|
(function (BaseMessageActionType) {
|
|
@@ -19,16 +19,8 @@ export var BaseMessageActionType;
|
|
|
19
19
|
BaseMessageActionType["Unlike"] = "unlike";
|
|
20
20
|
BaseMessageActionType["Delete"] = "delete";
|
|
21
21
|
})(BaseMessageActionType || (BaseMessageActionType = {}));
|
|
22
|
-
const BaseMessageActionIcons = {
|
|
23
|
-
[BaseMessageActionType.Copy]: CopyIcon,
|
|
24
|
-
[BaseMessageActionType.Edit]: Pencil,
|
|
25
|
-
[BaseMessageActionType.Retry]: ArrowRotateLeft,
|
|
26
|
-
[BaseMessageActionType.Like]: ThumbsUp,
|
|
27
|
-
[BaseMessageActionType.Unlike]: ThumbsDown,
|
|
28
|
-
[BaseMessageActionType.Delete]: TrashBin,
|
|
29
|
-
};
|
|
30
22
|
export const BaseMessage = (props) => {
|
|
31
|
-
const { className, qa, showActionsOnHover, actions, children, role: variant, showTimestamp, timestamp = '', } = props;
|
|
23
|
+
const { className, qa, showActionsOnHover, actions, children, role: variant, showTimestamp, timestamp = '', userRating, } = props;
|
|
32
24
|
// Get tooltip text for action
|
|
33
25
|
const getTooltipText = (actionType) => {
|
|
34
26
|
if (!actionType) {
|
|
@@ -49,9 +41,7 @@ export const BaseMessage = (props) => {
|
|
|
49
41
|
return _jsx(React.Fragment, { children: action }, index);
|
|
50
42
|
}
|
|
51
43
|
const tooltipText = getTooltipText(action.actionType);
|
|
52
|
-
const defaultIcon = action.actionType
|
|
53
|
-
? BaseMessageActionIcons[action.actionType]
|
|
54
|
-
: undefined;
|
|
44
|
+
const defaultIcon = getDefaultIcon(action.actionType, userRating);
|
|
55
45
|
// Determine tooltip title
|
|
56
46
|
let tooltipTitle;
|
|
57
47
|
if (action.label) {
|
|
@@ -77,3 +67,21 @@ export const BaseMessage = (props) => {
|
|
|
77
67
|
return (_jsx(ActionButton, Object.assign({}, action, { tooltipTitle: tooltipTitle, view: action.view || 'flat-secondary', children: buttonContent }), action.actionType || index));
|
|
78
68
|
}) })] }))] }));
|
|
79
69
|
};
|
|
70
|
+
function getDefaultIcon(actionType, userRating) {
|
|
71
|
+
switch (actionType) {
|
|
72
|
+
case BaseMessageActionType.Copy:
|
|
73
|
+
return CopyIcon;
|
|
74
|
+
case BaseMessageActionType.Edit:
|
|
75
|
+
return Pencil;
|
|
76
|
+
case BaseMessageActionType.Retry:
|
|
77
|
+
return ArrowRotateLeft;
|
|
78
|
+
case BaseMessageActionType.Delete:
|
|
79
|
+
return TrashBin;
|
|
80
|
+
case BaseMessageActionType.Like:
|
|
81
|
+
return userRating === 'like' ? ThumbsUpFill : ThumbsUp;
|
|
82
|
+
case BaseMessageActionType.Unlike:
|
|
83
|
+
return userRating === 'dislike' ? ThumbsDownFill : ThumbsDown;
|
|
84
|
+
default:
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
.g-aikit-button-group {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-wrap: wrap;
|
|
4
|
+
gap: var(--g-spacing-1);
|
|
5
|
+
}
|
|
6
|
+
.g-aikit-button-group_or_vertical {
|
|
7
|
+
flex-direction: column;
|
|
8
|
+
justify-content: center;
|
|
9
|
+
}
|
|
10
|
+
.g-aikit-button-group_or_horizontal {
|
|
11
|
+
flex-direction: row;
|
|
12
|
+
align-items: center;
|
|
13
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { block } from '../../../utils/cn';
|
|
3
|
-
import './ButtonGroup.
|
|
3
|
+
import './ButtonGroup.css';
|
|
4
4
|
const b = block('button-group');
|
|
5
5
|
export const ButtonGroup = (props) => {
|
|
6
6
|
const { orientation = 'horizontal', className, qa, children } = props;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.g-aikit-prompt-input-body {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
flex: 1;
|
|
5
|
+
align-self: stretch;
|
|
6
|
+
}
|
|
7
|
+
.g-aikit-prompt-input-body__textarea {
|
|
8
|
+
width: 100%;
|
|
9
|
+
}
|
|
10
|
+
.g-aikit-prompt-input-body__textarea-control {
|
|
11
|
+
resize: none;
|
|
12
|
+
}
|
|
13
|
+
.g-aikit-prompt-input-body .g-text-area_disabled {
|
|
14
|
+
--_--background-color: none;
|
|
15
|
+
}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
2
2
|
import { forwardRef } from 'react';
|
|
3
3
|
import { TextArea } from '@gravity-ui/uikit';
|
|
4
4
|
import { block } from '../../../utils/cn';
|
|
5
|
-
import './PromptInputBody.
|
|
5
|
+
import './PromptInputBody.css';
|
|
6
6
|
const b = block('prompt-input-body');
|
|
7
7
|
/**
|
|
8
8
|
* PromptInputBody component displays the main input area
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
.g-aikit-prompt-input-footer {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: flex-end;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
align-self: stretch;
|
|
6
|
+
gap: var(--g-spacing-1);
|
|
7
|
+
}
|
|
8
|
+
.g-aikit-prompt-input-footer__action-button {
|
|
9
|
+
color: var(--g-color-text-secondary);
|
|
10
|
+
}
|
|
11
|
+
.g-aikit-prompt-input-footer__action-button:hover {
|
|
12
|
+
color: var(--g-color-text-primary);
|
|
13
|
+
}
|
|
14
|
+
.g-aikit-prompt-input-footer__content {
|
|
15
|
+
display: flex;
|
|
16
|
+
align-items: center;
|
|
17
|
+
flex: 1;
|
|
18
|
+
}
|
|
@@ -6,7 +6,7 @@ import { ActionButton } from '../../atoms/ActionButton';
|
|
|
6
6
|
import { SubmitButton } from '../../atoms/SubmitButton';
|
|
7
7
|
import { ButtonGroup } from '../ButtonGroup';
|
|
8
8
|
import { i18n } from './i18n';
|
|
9
|
-
import './PromptInputFooter.
|
|
9
|
+
import './PromptInputFooter.css';
|
|
10
10
|
const b = block('prompt-input-footer');
|
|
11
11
|
/**
|
|
12
12
|
* PromptInputFooter component displays the footer section with action icons
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
.g-aikit-prompt-input-header {
|
|
2
|
+
display: flex;
|
|
3
|
+
align-items: center;
|
|
4
|
+
justify-content: space-between;
|
|
5
|
+
gap: var(--g-spacing-2);
|
|
6
|
+
align-self: stretch;
|
|
7
|
+
}
|
|
8
|
+
.g-aikit-prompt-input-header__context-items {
|
|
9
|
+
display: flex;
|
|
10
|
+
align-items: center;
|
|
11
|
+
gap: var(--g-spacing-1);
|
|
12
|
+
flex-wrap: wrap;
|
|
13
|
+
flex: 1;
|
|
14
|
+
min-width: 0;
|
|
15
|
+
}
|
|
16
|
+
.g-aikit-prompt-input-header__context-indicator {
|
|
17
|
+
display: flex;
|
|
18
|
+
align-items: center;
|
|
19
|
+
flex-shrink: 0;
|
|
20
|
+
margin-left: auto;
|
|
21
|
+
}
|
|
@@ -2,7 +2,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
2
2
|
import { block } from '../../../utils/cn';
|
|
3
3
|
import { ContextIndicator } from '../../atoms/ContextIndicator';
|
|
4
4
|
import { ContextItem } from '../../atoms/ContextItem';
|
|
5
|
-
import './PromptInputHeader.
|
|
5
|
+
import './PromptInputHeader.css';
|
|
6
6
|
const b = block('prompt-input-header');
|
|
7
7
|
/**
|
|
8
8
|
* PromptInputHeader component displays the header section of prompt input
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { block } from '../../../utils/cn';
|
|
3
|
-
import './PromptInputPanel.
|
|
3
|
+
import './PromptInputPanel.css';
|
|
4
4
|
const b = block('prompt-input-panel');
|
|
5
5
|
/**
|
|
6
6
|
* PromptInputPanel component displays a panel with custom content
|