@gravity-ui/aikit 0.6.0 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/dist/components/atoms/ActionButton/__stories__/ActionButton.stories.d.ts +8 -0
  2. package/dist/components/atoms/ActionButton/__stories__/ActionButton.stories.js +48 -0
  3. package/dist/components/atoms/Alert/__stories__/Alert.stories.d.ts +10 -0
  4. package/dist/components/atoms/Alert/__stories__/Alert.stories.js +72 -0
  5. package/dist/components/atoms/ChatDate/__stories__/ChatDate.stories.d.ts +16 -0
  6. package/dist/components/atoms/ChatDate/__stories__/ChatDate.stories.js +83 -0
  7. package/dist/components/atoms/ContextIndicator/__stories__/ContextIndicator.stories.d.ts +17 -0
  8. package/dist/components/atoms/ContextIndicator/__stories__/ContextIndicator.stories.js +72 -0
  9. package/dist/components/atoms/ContextItem/__stories__/ContextItem.stories.d.ts +8 -0
  10. package/dist/components/atoms/ContextItem/__stories__/ContextItem.stories.js +36 -0
  11. package/dist/components/atoms/DiffStat/__stories__/DiffStat.stories.d.ts +8 -0
  12. package/dist/components/atoms/DiffStat/__stories__/DiffStat.stories.js +45 -0
  13. package/dist/components/atoms/Disclaimer/__stories__/Disclaimer.stories.d.ts +12 -0
  14. package/dist/components/atoms/Disclaimer/__stories__/Disclaimer.stories.js +64 -0
  15. package/dist/components/atoms/Loader/__stories__/Loader.stories.d.ts +8 -0
  16. package/dist/components/atoms/Loader/__stories__/Loader.stories.js +47 -0
  17. package/dist/components/atoms/MarkdownRenderer/__stories__/MarkdownRenderer.stories.d.ts +6 -0
  18. package/dist/components/atoms/MarkdownRenderer/__stories__/MarkdownRenderer.stories.js +49 -0
  19. package/dist/components/atoms/MessageBalloon/__stories__/MessageBalloon.stories.d.ts +6 -0
  20. package/dist/components/atoms/MessageBalloon/__stories__/MessageBalloon.stories.js +32 -0
  21. package/dist/components/atoms/Shimmer/__stories__/Shimmer.stories.d.ts +5 -0
  22. package/dist/components/atoms/Shimmer/__stories__/Shimmer.stories.js +28 -0
  23. package/dist/components/atoms/SubmitButton/__stories__/SubmitButton.stories.d.ts +13 -0
  24. package/dist/components/atoms/SubmitButton/__stories__/SubmitButton.stories.js +98 -0
  25. package/dist/components/atoms/ToolIndicator/__stories__/ToolIndicator.stories.d.ts +9 -0
  26. package/dist/components/atoms/ToolIndicator/__stories__/ToolIndicator.stories.js +34 -0
  27. package/dist/components/molecules/BaseMessage/__stories__/BaseMessage.stories.d.ts +9 -0
  28. package/dist/components/molecules/BaseMessage/__stories__/BaseMessage.stories.js +77 -0
  29. package/dist/components/molecules/BaseMessage/index.d.ts +1 -1
  30. package/dist/components/molecules/BaseMessage/index.js +51 -20
  31. package/dist/components/molecules/ButtonGroup/__stories__/ButtonGroup.stories.d.ts +6 -0
  32. package/dist/components/molecules/ButtonGroup/__stories__/ButtonGroup.stories.js +44 -0
  33. package/dist/components/molecules/PromptInputBody/__stories__/PromptInputBody.stories.d.ts +11 -0
  34. package/dist/components/molecules/PromptInputBody/__stories__/PromptInputBody.stories.js +62 -0
  35. package/dist/components/molecules/PromptInputFooter/__stories__/PromptInputFooter.stories.d.ts +11 -0
  36. package/dist/components/molecules/PromptInputFooter/__stories__/PromptInputFooter.stories.js +96 -0
  37. package/dist/components/molecules/PromptInputHeader/__stories__/PromptInputHeader.stories.d.ts +15 -0
  38. package/dist/components/molecules/PromptInputHeader/__stories__/PromptInputHeader.stories.js +123 -0
  39. package/dist/components/molecules/PromptInputPanel/__stories__/PromptInputPanel.stories.d.ts +8 -0
  40. package/dist/components/molecules/PromptInputPanel/__stories__/PromptInputPanel.stories.js +38 -0
  41. package/dist/components/molecules/Suggestions/__stories__/Suggestions.stories.d.ts +22 -0
  42. package/dist/components/molecules/Suggestions/__stories__/Suggestions.stories.js +182 -0
  43. package/dist/components/molecules/Tabs/__stories__/Tabs.stories.d.ts +9 -0
  44. package/dist/components/molecules/Tabs/__stories__/Tabs.stories.js +103 -0
  45. package/dist/components/molecules/ToolFooter/__stories__/ToolFooter.stories.d.ts +7 -0
  46. package/dist/components/molecules/ToolFooter/__stories__/ToolFooter.stories.js +58 -0
  47. package/dist/components/molecules/ToolFooter/index.js +8 -1
  48. package/dist/components/molecules/ToolHeader/__stories__/ToolHeader.stories.d.ts +8 -0
  49. package/dist/components/molecules/ToolHeader/__stories__/ToolHeader.stories.js +59 -0
  50. package/dist/components/molecules/ToolHeader/index.js +10 -1
  51. package/dist/components/molecules/ToolStatus/__stories__/ToolStatus.stories.d.ts +9 -0
  52. package/dist/components/molecules/ToolStatus/__stories__/ToolStatus.stories.js +44 -0
  53. package/dist/components/organisms/AssistantMessage/__stories__/AssistantMessage.stories.d.ts +13 -0
  54. package/dist/components/organisms/AssistantMessage/__stories__/AssistantMessage.stories.js +151 -0
  55. package/dist/components/organisms/Header/Header.js +16 -17
  56. package/dist/components/organisms/Header/__stories__/Header.stories.d.ts +15 -0
  57. package/dist/components/organisms/Header/__stories__/Header.stories.js +159 -0
  58. package/dist/components/organisms/Header/types.d.ts +2 -3
  59. package/dist/components/organisms/Header/useHeader.d.ts +2 -4
  60. package/dist/components/organisms/Header/useHeader.js +2 -24
  61. package/dist/components/organisms/MessageList/MessageList.js +5 -6
  62. package/dist/components/organisms/MessageList/__stories__/MessageList.stories.d.ts +25 -0
  63. package/dist/components/organisms/MessageList/__stories__/MessageList.stories.js +340 -0
  64. package/dist/components/organisms/PromptInput/__stories__/PromptInput.stories.d.ts +19 -0
  65. package/dist/components/organisms/PromptInput/__stories__/PromptInput.stories.js +304 -0
  66. package/dist/components/organisms/ThinkingMessage/__stories__/ThinkingMessage.stories.d.ts +12 -0
  67. package/dist/components/organisms/ThinkingMessage/__stories__/ThinkingMessage.stories.js +105 -0
  68. package/dist/components/organisms/ToolMessage/__stories__/ToolMessage.stories.d.ts +11 -0
  69. package/dist/components/organisms/ToolMessage/__stories__/ToolMessage.stories.js +70 -0
  70. package/dist/components/organisms/UserMessage/__stories__/UserMessage.stories.d.ts +9 -0
  71. package/dist/components/organisms/UserMessage/__stories__/UserMessage.stories.js +118 -0
  72. package/dist/components/pages/ChatContainer/__stories__/ChatContainer.stories.d.ts +79 -0
  73. package/dist/components/pages/ChatContainer/__stories__/ChatContainer.stories.js +1006 -0
  74. package/dist/components/templates/ChatContent/__stories__/ChatContent.stories.d.ts +14 -0
  75. package/dist/components/templates/ChatContent/__stories__/ChatContent.stories.js +315 -0
  76. package/dist/components/templates/EmptyContainer/__stories__/EmptyContainer.stories.d.ts +20 -0
  77. package/dist/components/templates/EmptyContainer/__stories__/EmptyContainer.stories.js +250 -0
  78. package/dist/components/templates/History/ChatItem.d.ts +2 -2
  79. package/dist/components/templates/History/ChatItem.js +2 -5
  80. package/dist/components/templates/History/History.scss +13 -9
  81. package/dist/components/templates/History/HistoryList.d.ts +3 -1
  82. package/dist/components/templates/History/HistoryList.js +9 -5
  83. package/dist/components/templates/History/__stories__/History.stories.d.ts +18 -0
  84. package/dist/components/templates/History/__stories__/History.stories.js +289 -0
  85. package/dist/demo/ContentWrapper/ContentWrapper.d.ts +4 -0
  86. package/dist/demo/ContentWrapper/ContentWrapper.js +9 -0
  87. package/dist/demo/ContentWrapper/index.d.ts +1 -0
  88. package/dist/demo/ContentWrapper/index.js +1 -0
  89. package/dist/demo/Showcase/Showcase.d.ts +9 -0
  90. package/dist/demo/Showcase/Showcase.js +7 -0
  91. package/dist/demo/Showcase/index.d.ts +1 -0
  92. package/dist/demo/Showcase/index.js +1 -0
  93. package/dist/demo/ShowcaseItem/ShowcaseItem.d.ts +8 -0
  94. package/dist/demo/ShowcaseItem/ShowcaseItem.js +7 -0
  95. package/dist/demo/ShowcaseItem/index.d.ts +1 -0
  96. package/dist/demo/ShowcaseItem/index.js +1 -0
  97. package/dist/demo/SwapArea/SwapArea.d.ts +2 -0
  98. package/dist/demo/SwapArea/SwapArea.js +7 -0
  99. package/dist/demo/SwapArea/index.d.ts +1 -0
  100. package/dist/demo/SwapArea/index.js +1 -0
  101. package/dist/hooks/useSmartScroll.d.ts +7 -2
  102. package/dist/hooks/useSmartScroll.js +24 -22
  103. package/dist/types/common.d.ts +13 -5
  104. package/dist/types/messages.d.ts +9 -6
  105. package/dist/utils/actionUtils.d.ts +14 -0
  106. package/dist/utils/actionUtils.js +17 -0
  107. package/dist/utils/messageUtils.d.ts +7 -9
  108. package/dist/utils/messageUtils.js +7 -1
  109. package/package.json +12 -7
@@ -0,0 +1,96 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { PromptInputFooter } from '..';
3
+ import { ContentWrapper } from '../../../../demo/ContentWrapper';
4
+ import { SwapArea } from '../../../../demo/SwapArea';
5
+ import MDXDocs from './Docs.mdx';
6
+ export default {
7
+ title: 'molecules/PromptInputFooter',
8
+ component: PromptInputFooter,
9
+ parameters: {
10
+ docs: {
11
+ page: MDXDocs,
12
+ },
13
+ },
14
+ };
15
+ const defaultDecorators = [
16
+ (Story) => (_jsx(ContentWrapper, { width: "450px", children: _jsx(Story, {}) })),
17
+ ];
18
+ export const Playground = {
19
+ args: {
20
+ submitButton: {
21
+ // eslint-disable-next-line no-console
22
+ onClick: async () => console.log('Submit clicked'),
23
+ state: 'enabled',
24
+ },
25
+ },
26
+ decorators: defaultDecorators,
27
+ };
28
+ export const WithAllIcons = {
29
+ args: {
30
+ submitButton: {
31
+ // eslint-disable-next-line no-console
32
+ onClick: async () => console.log('Submit clicked'),
33
+ state: 'enabled',
34
+ },
35
+ showSettings: true,
36
+ showAttachment: true,
37
+ showMicrophone: true,
38
+ // eslint-disable-next-line no-console
39
+ onSettingsClick: () => console.log('Settings clicked'),
40
+ // eslint-disable-next-line no-console
41
+ onAttachmentClick: () => console.log('Attachment clicked'),
42
+ // eslint-disable-next-line no-console
43
+ onMicrophoneClick: () => console.log('Microphone clicked'),
44
+ },
45
+ decorators: defaultDecorators,
46
+ };
47
+ export const DisabledButton = {
48
+ args: {
49
+ submitButton: {
50
+ // eslint-disable-next-line no-console
51
+ onClick: async () => console.log('Submit clicked'),
52
+ state: 'disabled',
53
+ },
54
+ showSettings: true,
55
+ showAttachment: true,
56
+ showMicrophone: true,
57
+ },
58
+ decorators: defaultDecorators,
59
+ };
60
+ export const LoadingButton = {
61
+ args: {
62
+ submitButton: {
63
+ // eslint-disable-next-line no-console
64
+ onClick: async () => console.log('Submit clicked'),
65
+ state: 'loading',
66
+ },
67
+ showSettings: true,
68
+ showAttachment: true,
69
+ showMicrophone: true,
70
+ },
71
+ decorators: defaultDecorators,
72
+ };
73
+ export const CancelableButton = {
74
+ args: {
75
+ submitButton: {
76
+ // eslint-disable-next-line no-console
77
+ onClick: async () => console.log('Cancel clicked'),
78
+ state: 'cancelable',
79
+ },
80
+ showSettings: true,
81
+ showAttachment: true,
82
+ showMicrophone: true,
83
+ },
84
+ decorators: defaultDecorators,
85
+ };
86
+ export const WithCustomContent = {
87
+ args: {
88
+ submitButton: {
89
+ // eslint-disable-next-line no-console
90
+ onClick: async () => console.log('Submit clicked'),
91
+ state: 'enabled',
92
+ },
93
+ children: _jsx(SwapArea, {}),
94
+ },
95
+ decorators: defaultDecorators,
96
+ };
@@ -0,0 +1,15 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { PromptInputHeader } from '..';
3
+ declare const _default: Meta;
4
+ export default _default;
5
+ type Story = StoryObj<typeof PromptInputHeader>;
6
+ export declare const Playground: Story;
7
+ export declare const WithContextItems: Story;
8
+ export declare const WithSingleContextItem: Story;
9
+ export declare const WithManyContextItems: Story;
10
+ export declare const WithContextItemsAndIndicator: Story;
11
+ export declare const WithContextIndicator: Story;
12
+ export declare const WithContextIndicatorNumber: Story;
13
+ export declare const WithCustomContent: Story;
14
+ export declare const WithContextItemsWithoutRemove: Story;
15
+ export declare const WithMixedContextItems: Story;
@@ -0,0 +1,123 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { PromptInputHeader } from '..';
4
+ import { ContentWrapper } from '../../../../demo/ContentWrapper';
5
+ import { SwapArea } from '../../../../demo/SwapArea';
6
+ import MDXDocs from './Docs.mdx';
7
+ export default {
8
+ title: 'molecules/PromptInputHeader',
9
+ component: PromptInputHeader,
10
+ parameters: {
11
+ docs: {
12
+ page: MDXDocs,
13
+ },
14
+ },
15
+ };
16
+ const defaultDecorators = [
17
+ (Story) => (_jsx(ContentWrapper, { width: "450px", children: _jsx(Story, {}) })),
18
+ ];
19
+ export const Playground = {
20
+ args: {},
21
+ decorators: defaultDecorators,
22
+ };
23
+ export const WithContextItems = {
24
+ render: (args) => {
25
+ const [items, setItems] = useState([
26
+ { id: '1', content: 'file.tsx', onRemove: () => { } },
27
+ { id: '2', content: 'component.tsx', onRemove: () => { } },
28
+ { id: '3', content: 'utils.ts', onRemove: () => { } },
29
+ ]);
30
+ const handleRemove = (id) => {
31
+ setItems(items.filter((item) => item.id !== id));
32
+ };
33
+ return (_jsx(PromptInputHeader, Object.assign({}, args, { contextItems: items.map((item) => (Object.assign(Object.assign({}, item), { onRemove: () => handleRemove(item.id) }))) })));
34
+ },
35
+ decorators: defaultDecorators,
36
+ };
37
+ export const WithSingleContextItem = {
38
+ args: {
39
+ contextItems: [
40
+ {
41
+ id: '1',
42
+ content: 'README.md',
43
+ onRemove: () => {
44
+ // Handle remove
45
+ },
46
+ },
47
+ ],
48
+ },
49
+ decorators: defaultDecorators,
50
+ };
51
+ export const WithManyContextItems = {
52
+ args: {
53
+ contextItems: [
54
+ { id: '1', content: 'file1.tsx', onRemove: () => { } },
55
+ { id: '2', content: 'file2.tsx', onRemove: () => { } },
56
+ { id: '3', content: 'file3.tsx', onRemove: () => { } },
57
+ { id: '4', content: 'file4.tsx', onRemove: () => { } },
58
+ { id: '5', content: 'file5.tsx', onRemove: () => { } },
59
+ ],
60
+ },
61
+ decorators: defaultDecorators,
62
+ };
63
+ export const WithContextItemsAndIndicator = {
64
+ args: {
65
+ contextItems: [
66
+ { id: '1', content: 'file.tsx', onRemove: () => { } },
67
+ { id: '2', content: 'component.tsx', onRemove: () => { } },
68
+ ],
69
+ showContextIndicator: true,
70
+ contextIndicatorProps: {
71
+ type: 'percent',
72
+ usedContext: 75,
73
+ },
74
+ },
75
+ decorators: defaultDecorators,
76
+ };
77
+ export const WithContextIndicator = {
78
+ args: {
79
+ showContextIndicator: true,
80
+ contextIndicatorProps: {
81
+ type: 'percent',
82
+ usedContext: 24,
83
+ },
84
+ },
85
+ decorators: defaultDecorators,
86
+ };
87
+ export const WithContextIndicatorNumber = {
88
+ args: {
89
+ showContextIndicator: true,
90
+ contextIndicatorProps: {
91
+ type: 'number',
92
+ usedContext: 2400,
93
+ maxContext: 10000,
94
+ },
95
+ },
96
+ decorators: defaultDecorators,
97
+ };
98
+ export const WithCustomContent = {
99
+ args: {
100
+ children: _jsx(SwapArea, {}),
101
+ },
102
+ decorators: defaultDecorators,
103
+ };
104
+ export const WithContextItemsWithoutRemove = {
105
+ args: {
106
+ contextItems: [
107
+ { id: '1', content: 'file.tsx' },
108
+ { id: '2', content: 'component.tsx' },
109
+ { id: '3', content: 'utils.ts' },
110
+ ],
111
+ },
112
+ decorators: defaultDecorators,
113
+ };
114
+ export const WithMixedContextItems = {
115
+ args: {
116
+ contextItems: [
117
+ { id: '1', content: 'file.tsx', onRemove: () => { } },
118
+ { id: '2', content: 'component.tsx' },
119
+ { id: '3', content: 'utils.ts', onRemove: () => { } },
120
+ ],
121
+ },
122
+ decorators: defaultDecorators,
123
+ };
@@ -0,0 +1,8 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { PromptInputPanel } from '..';
3
+ declare const _default: Meta;
4
+ export default _default;
5
+ type Story = StoryObj<typeof PromptInputPanel>;
6
+ export declare const Playground: Story;
7
+ export declare const WithSwapArea: Story;
8
+ export declare const WithContentAndCloseButton: Story;
@@ -0,0 +1,38 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Xmark } from '@gravity-ui/icons';
3
+ import { Button, Icon } from '@gravity-ui/uikit';
4
+ import { PromptInputPanel } from '..';
5
+ import { ContentWrapper } from '../../../../demo/ContentWrapper';
6
+ import { SwapArea } from '../../../../demo/SwapArea';
7
+ import { ActionButton } from '../../../atoms/ActionButton';
8
+ import MDXDocs from './Docs.mdx';
9
+ export default {
10
+ title: 'molecules/PromptInputPanel',
11
+ component: PromptInputPanel,
12
+ parameters: {
13
+ docs: {
14
+ page: MDXDocs,
15
+ },
16
+ },
17
+ };
18
+ const defaultDecorators = [
19
+ (Story) => (_jsx(ContentWrapper, { children: _jsx(Story, {}) })),
20
+ ];
21
+ export const Playground = {
22
+ args: {
23
+ children: 'This is the panel content',
24
+ },
25
+ decorators: defaultDecorators,
26
+ };
27
+ export const WithSwapArea = {
28
+ args: {
29
+ children: _jsx(SwapArea, {}),
30
+ },
31
+ decorators: defaultDecorators,
32
+ };
33
+ export const WithContentAndCloseButton = {
34
+ args: {
35
+ children: (_jsxs(_Fragment, { children: [_jsx("div", { style: { flex: 1 }, children: _jsx("span", { children: "Upgrade your plan to Business to unlock all features" }) }), _jsx(Button, { view: "action", size: "m", children: "Upgrade" }), _jsx(ActionButton, { view: "flat", size: "m", onClick: () => { }, children: _jsx(Icon, { data: Xmark, size: 16 }) })] })),
36
+ },
37
+ decorators: defaultDecorators,
38
+ };
@@ -0,0 +1,22 @@
1
+ import { Meta, StoryFn } from '@storybook/react-webpack5';
2
+ import { SuggestionsProps } from '..';
3
+ declare const _default: Meta;
4
+ export default _default;
5
+ export declare const Playground: StoryFn<SuggestionsProps>;
6
+ export declare const ListLayout: StoryFn<SuggestionsProps>;
7
+ export declare const ListLayoutWithContainer: StoryFn<SuggestionsProps>;
8
+ export declare const WrapTextListLayoutWithContainer: StoryFn<SuggestionsProps>;
9
+ export declare const GridLayout: StoryFn<SuggestionsProps>;
10
+ export declare const GridLayoutWithContainer: StoryFn<SuggestionsProps>;
11
+ export declare const WithoutIds: StoryFn<SuggestionsProps>;
12
+ export declare const SingleItem: StoryFn<SuggestionsProps>;
13
+ export declare const TextAlignLeft: StoryFn<SuggestionsProps>;
14
+ export declare const TextAlignCenter: StoryFn<SuggestionsProps>;
15
+ export declare const TextAlignRight: StoryFn<SuggestionsProps>;
16
+ export declare const WithLeftIcon: StoryFn<SuggestionsProps>;
17
+ export declare const WithRightIcon: StoryFn<SuggestionsProps>;
18
+ export declare const WithMixedIcons: StoryFn<SuggestionsProps>;
19
+ export declare const IconsWithContainer: StoryFn<SuggestionsProps>;
20
+ export declare const WithIconsInGridLayout: StoryFn<SuggestionsProps>;
21
+ export declare const WithTitle: StoryFn<SuggestionsProps>;
22
+ export declare const WithTitleAndGridLayout: StoryFn<SuggestionsProps>;
@@ -0,0 +1,182 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Suggestions } from '..';
3
+ import { ContentWrapper } from '../../../../demo/ContentWrapper';
4
+ import MDXDocs from './Docs.mdx';
5
+ export default {
6
+ title: 'molecules/Suggestions',
7
+ component: Suggestions,
8
+ parameters: {
9
+ docs: {
10
+ page: MDXDocs,
11
+ },
12
+ },
13
+ argTypes: {
14
+ items: {
15
+ control: 'object',
16
+ description: 'Array of suggestion items to display',
17
+ },
18
+ onClick: {
19
+ action: 'clicked',
20
+ description: 'Callback function called when a suggestion is clicked',
21
+ },
22
+ title: {
23
+ control: 'text',
24
+ description: 'Title to display above suggestions',
25
+ },
26
+ layout: {
27
+ control: 'select',
28
+ options: ['grid', 'list'],
29
+ description: 'Layout orientation: grid for horizontal, list for vertical',
30
+ },
31
+ textAlign: {
32
+ control: 'select',
33
+ options: ['left', 'center', 'right'],
34
+ description: 'Text alignment inside buttons',
35
+ },
36
+ wrapText: {
37
+ control: 'boolean',
38
+ description: 'Enable text wrapping inside buttons instead of ellipsis',
39
+ },
40
+ className: {
41
+ control: 'text',
42
+ description: 'Additional CSS class',
43
+ },
44
+ qa: {
45
+ control: 'text',
46
+ description: 'QA/test identifier',
47
+ },
48
+ },
49
+ };
50
+ export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args)) }));
51
+ Playground.args = {
52
+ items: [
53
+ { id: '1', title: 'First suggestion' },
54
+ { id: '2', title: 'Second suggestion' },
55
+ { id: '3', title: 'Third suggestion' },
56
+ ],
57
+ onClick: () => {
58
+ // onClick handler
59
+ },
60
+ layout: 'list',
61
+ };
62
+ export const ListLayout = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
63
+ { id: '1', title: 'Example suggestion' },
64
+ { id: '2', title: 'Another one suggestion' },
65
+ { id: '3', title: 'Looooooong suggestion for testing' },
66
+ ], layout: "list", onClick: () => {
67
+ // onClick handler
68
+ } })) }));
69
+ export const ListLayoutWithContainer = (args) => (_jsx(ContentWrapper, { width: "200px", children: _jsx(Suggestions, Object.assign({}, args, { items: [
70
+ { id: '1', title: 'Example suggestion' },
71
+ { id: '2', title: 'Another one suggestion' },
72
+ { id: '3', title: 'Looooooong suggestion for testing' },
73
+ ], layout: "list", onClick: () => {
74
+ // onClick handler
75
+ } })) }));
76
+ export const WrapTextListLayoutWithContainer = (args) => (_jsx(ContentWrapper, { width: "400px", children: _jsx(Suggestions, Object.assign({}, args, { items: [
77
+ {
78
+ id: '1',
79
+ title: 'This is a short.',
80
+ },
81
+ {
82
+ id: '2',
83
+ title: 'This is a long suggestion text generated to be exactly 256 characters long for testing component behavior. It fills up space with enough repetition and verbosity to ensure that you can clearly see where truncation or overflow might appear.',
84
+ },
85
+ {
86
+ id: '3',
87
+ title: 'Another extra long suggestion exactly 256 characters in length. Used to test how well the UI handles longer entries and maintains design consistency.',
88
+ },
89
+ ], layout: "list", wrapText: true, onClick: () => {
90
+ // onClick handler
91
+ } })) }));
92
+ export const GridLayout = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
93
+ { id: '1', title: 'Option 1' },
94
+ { id: '2', title: 'Option 2' },
95
+ { id: '3', title: 'Option 3' },
96
+ { id: '4', title: 'Option 4' },
97
+ ], layout: "grid", onClick: () => {
98
+ // onClick handler
99
+ } })) }));
100
+ export const GridLayoutWithContainer = (args) => (_jsx(ContentWrapper, { width: "300px", children: _jsx(Suggestions, Object.assign({}, args, { items: [
101
+ { id: '1', title: 'Option 1' },
102
+ { id: '2', title: 'Option 2' },
103
+ { id: '3', title: 'Option 3' },
104
+ { id: '4', title: 'Option 4' },
105
+ ], layout: "grid", onClick: () => {
106
+ // onClick handler
107
+ } })) }));
108
+ export const WithoutIds = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [{ title: 'First item' }, { title: 'Second item' }, { title: 'Third item' }], onClick: () => {
109
+ // onClick handler
110
+ } })) }));
111
+ export const SingleItem = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [{ id: '1', title: 'Only one suggestion' }], onClick: () => {
112
+ // onClick handler
113
+ } })) }));
114
+ export const TextAlignLeft = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
115
+ { id: '1', title: 'Left aligned text' },
116
+ { id: '2', title: 'Another left aligned suggestion' },
117
+ ], textAlign: "left", onClick: () => {
118
+ // onClick handler
119
+ } })) }));
120
+ export const TextAlignCenter = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
121
+ { id: '1', title: 'Center aligned text' },
122
+ { id: '2', title: 'Another centered suggestion' },
123
+ ], textAlign: "center", onClick: () => {
124
+ // onClick handler
125
+ } })) }));
126
+ export const TextAlignRight = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
127
+ { id: '1', title: 'Right aligned text' },
128
+ { id: '2', title: 'Another right aligned suggestion' },
129
+ ], textAlign: "right", onClick: () => {
130
+ // onClick handler
131
+ } })) }));
132
+ export const WithLeftIcon = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
133
+ { id: '1', title: 'Previous page', icon: 'left' },
134
+ { id: '2', title: 'Go back', icon: 'left' },
135
+ { id: '3', title: 'Return to start', icon: 'left' },
136
+ ], onClick: () => {
137
+ // onClick handler
138
+ } })) }));
139
+ export const WithRightIcon = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
140
+ { id: '1', title: 'Next page', icon: 'right' },
141
+ { id: '2', title: 'Continue', icon: 'right' },
142
+ { id: '3', title: 'Go forward', icon: 'right' },
143
+ ], onClick: () => {
144
+ // onClick handler
145
+ } })) }));
146
+ export const WithMixedIcons = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
147
+ { id: '1', title: 'Previous', icon: 'left' },
148
+ { id: '2', title: 'No action' },
149
+ { id: '3', title: 'Next', icon: 'right' },
150
+ ], layout: "grid", onClick: () => {
151
+ // onClick handler
152
+ } })) }));
153
+ export const IconsWithContainer = (args) => (_jsx(ContentWrapper, { width: "200px", children: _jsx(Suggestions, Object.assign({}, args, { items: [
154
+ { id: '1', title: 'Example suggestion', icon: 'right' },
155
+ { id: '2', title: 'Another one suggestion', icon: 'right' },
156
+ { id: '3', title: 'Looooooong suggestion for testing', icon: 'right' },
157
+ ], layout: "list", onClick: () => {
158
+ // onClick handler
159
+ } })) }));
160
+ export const WithIconsInGridLayout = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
161
+ { id: '1', title: 'Back', icon: 'left' },
162
+ { id: '2', title: 'Home' },
163
+ { id: '3', title: 'Settings' },
164
+ { id: '4', title: 'Forward', icon: 'right' },
165
+ ], layout: "grid", onClick: () => {
166
+ // onClick handler
167
+ } })) }));
168
+ export const WithTitle = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { title: "Try asking about:", items: [
169
+ { id: '1', title: 'What is AI?' },
170
+ { id: '2', title: 'How does machine learning work?' },
171
+ { id: '3', title: 'What are neural networks?' },
172
+ ], layout: "list", onClick: () => {
173
+ // onClick handler
174
+ } })) }));
175
+ export const WithTitleAndGridLayout = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { title: "Popular topics", items: [
176
+ { id: '1', title: 'Getting started' },
177
+ { id: '2', title: 'Documentation' },
178
+ { id: '3', title: 'API Reference' },
179
+ { id: '4', title: 'Examples' },
180
+ ], layout: "grid", onClick: () => {
181
+ // onClick handler
182
+ } })) }));
@@ -0,0 +1,9 @@
1
+ import { Meta, StoryFn, StoryObj } from '@storybook/react-webpack5';
2
+ import { type TabsProps } from '..';
3
+ declare const _default: Meta;
4
+ export default _default;
5
+ export declare const Playground: StoryFn<TabsProps>;
6
+ export declare const Basic: StoryObj<TabsProps>;
7
+ export declare const WithIcons: StoryObj<TabsProps>;
8
+ export declare const WithStyle: StoryObj<TabsProps>;
9
+ export declare const MaxWidth: StoryObj<TabsProps>;
@@ -0,0 +1,103 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { At, Envelope, Gear } from '@gravity-ui/icons';
3
+ import { Icon } from '@gravity-ui/uikit';
4
+ import { Tabs } from '..';
5
+ import { ContentWrapper } from '../../../../demo/ContentWrapper';
6
+ import { Showcase } from '../../../../demo/Showcase';
7
+ import { ShowcaseItem } from '../../../../demo/ShowcaseItem';
8
+ import MDXDocs from './Docs.mdx';
9
+ export default {
10
+ title: 'molecules/Tabs',
11
+ component: Tabs,
12
+ parameters: {
13
+ docs: {
14
+ page: MDXDocs,
15
+ },
16
+ },
17
+ argTypes: {
18
+ items: {
19
+ control: 'object',
20
+ description: 'Array of tab items',
21
+ },
22
+ activeId: {
23
+ control: 'text',
24
+ description: 'ID of the currently active tab',
25
+ },
26
+ allowDelete: {
27
+ control: 'boolean',
28
+ description: 'Whether to show delete buttons',
29
+ },
30
+ className: {
31
+ control: 'text',
32
+ description: 'Additional CSS class',
33
+ },
34
+ styles: {
35
+ control: 'object',
36
+ description: 'Additional CSS properties',
37
+ },
38
+ },
39
+ };
40
+ const defaultDecorators = [
41
+ (Story) => (_jsx(ContentWrapper, { children: _jsx(Showcase, { children: _jsx(Story, {}) }) })),
42
+ ];
43
+ const basicItems = [
44
+ { id: '1', title: 'Chat name 1' },
45
+ { id: '2', title: 'Chat name 2' },
46
+ { id: '3', title: 'Chat name 3' },
47
+ { id: '4', title: 'Chat name 4' },
48
+ ];
49
+ const itemsWithIcons = [
50
+ { id: '1', title: 'Chat name 1', icon: _jsx(Icon, { data: At, size: 16 }) },
51
+ { id: '2', title: 'Chat name 2', icon: _jsx(Icon, { data: Envelope, size: 16 }) },
52
+ { id: '3', title: 'Chat name 3', icon: _jsx(Icon, { data: Gear, size: 16 }) },
53
+ ];
54
+ export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(Tabs, Object.assign({}, args)) }));
55
+ Playground.args = {
56
+ items: basicItems,
57
+ activeId: '1',
58
+ allowDelete: true,
59
+ };
60
+ export const Basic = {
61
+ render: (args) => (_jsx(ShowcaseItem, { title: "Basic Tabs", children: _jsx(Tabs, Object.assign({}, args)) })),
62
+ decorators: defaultDecorators,
63
+ };
64
+ Basic.args = {
65
+ items: basicItems,
66
+ activeId: '1',
67
+ allowDelete: true,
68
+ };
69
+ export const WithIcons = {
70
+ render: (args) => (_jsx(ShowcaseItem, { title: "Tabs with Icons", children: _jsx(Tabs, Object.assign({}, args)) })),
71
+ decorators: defaultDecorators,
72
+ };
73
+ WithIcons.args = {
74
+ items: itemsWithIcons,
75
+ activeId: '1',
76
+ allowDelete: true,
77
+ };
78
+ export const WithStyle = {
79
+ render: (args) => (_jsx(ShowcaseItem, { title: "Tabs with Style", children: _jsx(Tabs, Object.assign({}, args)) })),
80
+ decorators: defaultDecorators,
81
+ };
82
+ WithStyle.args = {
83
+ items: basicItems,
84
+ activeId: '1',
85
+ allowDelete: true,
86
+ style: {
87
+ '--g-color-base-info-light': '#ff9100',
88
+ '--g-color-base-info-light-hover': '#aa9100',
89
+ '--g-color-text-info-heavy': '#ffffff',
90
+ '--g-color-base-simple-hover': '#aa9100',
91
+ '--g-color-text-complementary': '#ff9100',
92
+ '--g-color-line-generic': '#ff9100',
93
+ },
94
+ };
95
+ export const MaxWidth = {
96
+ render: (args) => (_jsx(ShowcaseItem, { title: "Max width (200px)", children: _jsxs("div", { style: { maxWidth: '200px', border: '1px solid lightgray' }, children: [_jsx("h1", { style: { paddingInline: '10px' }, children: "Lorem ipsum" }), _jsx(Tabs, Object.assign({}, args)), _jsx("p", { style: { paddingInline: '10px' }, children: "Lorem ipsum dolor sit amet consectetur adipisicing elit. Optio consectetur commodi natus dolor repellendus sit, similique aliquam, quia ad hic quam porro nobis a? Cumque ratione est nostrum exercitationem velit." })] }) })),
97
+ decorators: defaultDecorators,
98
+ };
99
+ MaxWidth.args = {
100
+ items: basicItems,
101
+ activeId: '1',
102
+ allowDelete: true,
103
+ };
@@ -0,0 +1,7 @@
1
+ import { Meta, StoryFn, StoryObj } from '@storybook/react-webpack5';
2
+ import { ToolFooterProps } from 'src/types';
3
+ declare const _default: Meta;
4
+ export default _default;
5
+ export declare const Playground: StoryFn<ToolFooterProps>;
6
+ export declare const ConfirmationState: StoryObj<ToolFooterProps>;
7
+ export declare const WaitingState: StoryObj<ToolFooterProps>;
@@ -0,0 +1,58 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { ToolFooter } from '..';
3
+ import { ContentWrapper } from '../../../../demo/ContentWrapper';
4
+ import { Showcase } from '../../../../demo/Showcase';
5
+ import { ShowcaseItem } from '../../../../demo/ShowcaseItem';
6
+ import MDXDocs from './Docs.mdx';
7
+ export default {
8
+ title: 'molecules/ToolFooter',
9
+ component: ToolFooter,
10
+ parameters: {
11
+ docs: {
12
+ page: MDXDocs,
13
+ },
14
+ },
15
+ argTypes: {
16
+ content: {
17
+ control: 'text',
18
+ description: 'Status message to display',
19
+ },
20
+ showLoader: {
21
+ control: 'boolean',
22
+ description: 'Whether to show loading indicator',
23
+ },
24
+ },
25
+ };
26
+ const defaultDecorators = [
27
+ (Story) => (_jsx(Showcase, { children: _jsx(Story, {}) })),
28
+ ];
29
+ const rejectAction = {
30
+ label: 'Reject',
31
+ onClick: () => alert('Rejected'),
32
+ view: 'outlined',
33
+ };
34
+ const acceptAction = {
35
+ label: 'Accept',
36
+ onClick: () => alert('Accepted'),
37
+ view: 'action',
38
+ };
39
+ const cancelAction = {
40
+ label: 'Cancel',
41
+ onClick: () => alert('Cancelled'),
42
+ view: 'outlined',
43
+ };
44
+ const defaultActions = [rejectAction, acceptAction];
45
+ export const Playground = (args) => (_jsx(ContentWrapper, { width: "430px", children: _jsx(ToolFooter, Object.assign({}, args)) }));
46
+ Playground.args = {
47
+ content: 'Awaiting confirmation',
48
+ actions: defaultActions,
49
+ showLoader: true,
50
+ };
51
+ export const ConfirmationState = {
52
+ render: (args) => (_jsx(ShowcaseItem, { title: "Confirmation State", children: _jsx(ContentWrapper, { width: "430px", children: _jsx(ToolFooter, Object.assign({}, args, { content: "Awaiting confirmation", actions: defaultActions })) }) })),
53
+ decorators: defaultDecorators,
54
+ };
55
+ export const WaitingState = {
56
+ render: (args) => (_jsx(ShowcaseItem, { title: "Waiting State", children: _jsx(ContentWrapper, { width: "430px", children: _jsx(ToolFooter, Object.assign({}, args, { content: "Awaiting form submission", actions: [cancelAction] })) }) })),
57
+ decorators: defaultDecorators,
58
+ };