@gravity-ui/aikit 0.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.
- package/LICENSE +21 -0
- package/README.md +190 -0
- package/dist/.storybook/theme.d.ts +6 -0
- package/dist/.storybook/theme.js +28 -0
- package/dist/package.json +111 -0
- package/dist/src/components/atoms/ActionButton/ActionButton.d.ts +47 -0
- package/dist/src/components/atoms/ActionButton/ActionButton.js +34 -0
- package/dist/src/components/atoms/ActionButton/__stories__/ActionButton.stories.d.ts +8 -0
- package/dist/src/components/atoms/ActionButton/__stories__/ActionButton.stories.js +48 -0
- package/dist/src/components/atoms/ActionButton/index.d.ts +2 -0
- package/dist/src/components/atoms/ActionButton/index.js +1 -0
- package/dist/src/components/atoms/Alert/__stories__/Alert.stories.d.ts +9 -0
- package/dist/src/components/atoms/Alert/__stories__/Alert.stories.js +56 -0
- package/dist/src/components/atoms/Alert/index.d.ts +13 -0
- package/dist/src/components/atoms/Alert/index.js +25 -0
- package/dist/src/components/atoms/ChatDate/ChatDate.d.ts +19 -0
- package/dist/src/components/atoms/ChatDate/ChatDate.js +24 -0
- package/dist/src/components/atoms/ChatDate/__stories__/ChatDate.stories.d.ts +16 -0
- package/dist/src/components/atoms/ChatDate/__stories__/ChatDate.stories.js +83 -0
- package/dist/src/components/atoms/ChatDate/i18n/en.json +8 -0
- package/dist/src/components/atoms/ChatDate/i18n/index.d.ts +13 -0
- package/dist/src/components/atoms/ChatDate/i18n/index.js +5 -0
- package/dist/src/components/atoms/ChatDate/i18n/ru.json +10 -0
- package/dist/src/components/atoms/ChatDate/index.d.ts +1 -0
- package/dist/src/components/atoms/ChatDate/index.js +1 -0
- package/dist/src/components/atoms/ContextIndicator/__stories__/ContextIndicator.stories.d.ts +17 -0
- package/dist/src/components/atoms/ContextIndicator/__stories__/ContextIndicator.stories.js +72 -0
- package/dist/src/components/atoms/ContextIndicator/index.d.ts +19 -0
- package/dist/src/components/atoms/ContextIndicator/index.js +16 -0
- package/dist/src/components/atoms/ContextIndicator/utils.d.ts +1 -0
- package/dist/src/components/atoms/ContextIndicator/utils.js +9 -0
- package/dist/src/components/atoms/ContextItem/__stories__/ContextItem.stories.d.ts +6 -0
- package/dist/src/components/atoms/ContextItem/__stories__/ContextItem.stories.js +32 -0
- package/dist/src/components/atoms/ContextItem/index.d.ts +9 -0
- package/dist/src/components/atoms/ContextItem/index.js +8 -0
- package/dist/src/components/atoms/DiffStat/__stories__/DiffStat.stories.d.ts +7 -0
- package/dist/src/components/atoms/DiffStat/__stories__/DiffStat.stories.js +45 -0
- package/dist/src/components/atoms/DiffStat/index.d.ts +8 -0
- package/dist/src/components/atoms/DiffStat/index.js +8 -0
- package/dist/src/components/atoms/Disclaimer/Disclaimer.d.ts +19 -0
- package/dist/src/components/atoms/Disclaimer/Disclaimer.js +15 -0
- package/dist/src/components/atoms/Disclaimer/__stories__/Disclaimer.stories.d.ts +8 -0
- package/dist/src/components/atoms/Disclaimer/__stories__/Disclaimer.stories.js +32 -0
- package/dist/src/components/atoms/Disclaimer/index.d.ts +1 -0
- package/dist/src/components/atoms/Disclaimer/index.js +1 -0
- package/dist/src/components/atoms/InlineCitation/index.d.ts +1 -0
- package/dist/src/components/atoms/InlineCitation/index.js +1 -0
- package/dist/src/components/atoms/Loader/Loader.d.ts +9 -0
- package/dist/src/components/atoms/Loader/Loader.js +11 -0
- package/dist/src/components/atoms/Loader/__stories__/Loader.stories.d.ts +8 -0
- package/dist/src/components/atoms/Loader/__stories__/Loader.stories.js +47 -0
- package/dist/src/components/atoms/Loader/index.d.ts +1 -0
- package/dist/src/components/atoms/Loader/index.js +1 -0
- package/dist/src/components/atoms/MarkdownRenderer/MarkdownRenderer.d.ts +10 -0
- package/dist/src/components/atoms/MarkdownRenderer/MarkdownRenderer.js +24 -0
- package/dist/src/components/atoms/MarkdownRenderer/__stories__/MarkdownRenderer.stories.d.ts +6 -0
- package/dist/src/components/atoms/MarkdownRenderer/__stories__/MarkdownRenderer.stories.js +49 -0
- package/dist/src/components/atoms/MarkdownRenderer/index.d.ts +1 -0
- package/dist/src/components/atoms/MarkdownRenderer/index.js +1 -0
- package/dist/src/components/atoms/MessageBalloon/__stories__/MessageBalloon.stories.d.ts +6 -0
- package/dist/src/components/atoms/MessageBalloon/__stories__/MessageBalloon.stories.js +32 -0
- package/dist/src/components/atoms/MessageBalloon/index.d.ts +7 -0
- package/dist/src/components/atoms/MessageBalloon/index.js +8 -0
- package/dist/src/components/atoms/Shimmer/__stories__/Shimmer.stories.d.ts +5 -0
- package/dist/src/components/atoms/Shimmer/__stories__/Shimmer.stories.js +28 -0
- package/dist/src/components/atoms/Shimmer/index.d.ts +6 -0
- package/dist/src/components/atoms/Shimmer/index.js +8 -0
- package/dist/src/components/atoms/SubmitButton/SubmitButton.d.ts +37 -0
- package/dist/src/components/atoms/SubmitButton/SubmitButton.js +33 -0
- package/dist/src/components/atoms/SubmitButton/__stories__/SubmitButton.stories.d.ts +12 -0
- package/dist/src/components/atoms/SubmitButton/__stories__/SubmitButton.stories.js +95 -0
- package/dist/src/components/atoms/SubmitButton/i18n/en.json +3 -0
- package/dist/src/components/atoms/SubmitButton/i18n/index.d.ts +13 -0
- package/dist/src/components/atoms/SubmitButton/i18n/index.js +5 -0
- package/dist/src/components/atoms/SubmitButton/i18n/ru.json +3 -0
- package/dist/src/components/atoms/SubmitButton/index.d.ts +1 -0
- package/dist/src/components/atoms/SubmitButton/index.js +1 -0
- package/dist/src/components/atoms/ToolIndicator/__stories__/ToolIndicator.stories.d.ts +9 -0
- package/dist/src/components/atoms/ToolIndicator/__stories__/ToolIndicator.stories.js +34 -0
- package/dist/src/components/atoms/ToolIndicator/index.d.ts +7 -0
- package/dist/src/components/atoms/ToolIndicator/index.js +26 -0
- package/dist/src/components/atoms/index.d.ts +14 -0
- package/dist/src/components/atoms/index.js +15 -0
- package/dist/src/components/index.d.ts +5 -0
- package/dist/src/components/index.js +6 -0
- package/dist/src/components/molecules/BaseMessage/__stories__/BaseMessage.stories.d.ts +8 -0
- package/dist/src/components/molecules/BaseMessage/__stories__/BaseMessage.stories.js +66 -0
- package/dist/src/components/molecules/BaseMessage/i18n/en.json +8 -0
- package/dist/src/components/molecules/BaseMessage/i18n/index.d.ts +13 -0
- package/dist/src/components/molecules/BaseMessage/i18n/index.js +5 -0
- package/dist/src/components/molecules/BaseMessage/i18n/ru.json +8 -0
- package/dist/src/components/molecules/BaseMessage/index.d.ts +11 -0
- package/dist/src/components/molecules/BaseMessage/index.js +48 -0
- package/dist/src/components/molecules/ButtonGroup/__stories__/ButtonGroup.stories.d.ts +6 -0
- package/dist/src/components/molecules/ButtonGroup/__stories__/ButtonGroup.stories.js +44 -0
- package/dist/src/components/molecules/ButtonGroup/index.d.ts +8 -0
- package/dist/src/components/molecules/ButtonGroup/index.js +8 -0
- package/dist/src/components/molecules/InputContext/index.d.ts +1 -0
- package/dist/src/components/molecules/InputContext/index.js +1 -0
- package/dist/src/components/molecules/PromptInputBody/PromptInputBody.d.ts +39 -0
- package/dist/src/components/molecules/PromptInputBody/PromptInputBody.js +26 -0
- package/dist/src/components/molecules/PromptInputBody/__stories__/PromptInputBody.stories.d.ts +11 -0
- package/dist/src/components/molecules/PromptInputBody/__stories__/PromptInputBody.stories.js +62 -0
- package/dist/src/components/molecules/PromptInputBody/index.d.ts +1 -0
- package/dist/src/components/molecules/PromptInputBody/index.js +1 -0
- package/dist/src/components/molecules/PromptInputFooter/PromptInputFooter.d.ts +39 -0
- package/dist/src/components/molecules/PromptInputFooter/PromptInputFooter.js +26 -0
- package/dist/src/components/molecules/PromptInputFooter/__stories__/PromptInputFooter.stories.d.ts +11 -0
- package/dist/src/components/molecules/PromptInputFooter/__stories__/PromptInputFooter.stories.js +96 -0
- package/dist/src/components/molecules/PromptInputFooter/i18n/en.json +5 -0
- package/dist/src/components/molecules/PromptInputFooter/i18n/index.d.ts +13 -0
- package/dist/src/components/molecules/PromptInputFooter/i18n/index.js +5 -0
- package/dist/src/components/molecules/PromptInputFooter/i18n/ru.json +5 -0
- package/dist/src/components/molecules/PromptInputFooter/index.d.ts +1 -0
- package/dist/src/components/molecules/PromptInputFooter/index.js +1 -0
- package/dist/src/components/molecules/PromptInputHeader/PromptInputHeader.d.ts +39 -0
- package/dist/src/components/molecules/PromptInputHeader/PromptInputHeader.js +28 -0
- package/dist/src/components/molecules/PromptInputHeader/__stories__/PromptInputHeader.stories.d.ts +13 -0
- package/dist/src/components/molecules/PromptInputHeader/__stories__/PromptInputHeader.stories.js +103 -0
- package/dist/src/components/molecules/PromptInputHeader/index.d.ts +1 -0
- package/dist/src/components/molecules/PromptInputHeader/index.js +1 -0
- package/dist/src/components/molecules/PromptInputPanel/PromptInputPanel.d.ts +20 -0
- package/dist/src/components/molecules/PromptInputPanel/PromptInputPanel.js +14 -0
- package/dist/src/components/molecules/PromptInputPanel/__stories__/PromptInputPanel.stories.d.ts +8 -0
- package/dist/src/components/molecules/PromptInputPanel/__stories__/PromptInputPanel.stories.js +38 -0
- package/dist/src/components/molecules/PromptInputPanel/index.d.ts +2 -0
- package/dist/src/components/molecules/PromptInputPanel/index.js +1 -0
- package/dist/src/components/molecules/Suggestions/Suggestions.d.ts +37 -0
- package/dist/src/components/molecules/Suggestions/Suggestions.js +27 -0
- package/dist/src/components/molecules/Suggestions/__stories__/Suggestions.stories.d.ts +19 -0
- package/dist/src/components/molecules/Suggestions/__stories__/Suggestions.stories.js +143 -0
- package/dist/src/components/molecules/Suggestions/index.d.ts +1 -0
- package/dist/src/components/molecules/Suggestions/index.js +1 -0
- package/dist/src/components/molecules/Tabs/Tabs.d.ts +15 -0
- package/dist/src/components/molecules/Tabs/Tabs.js +24 -0
- package/dist/src/components/molecules/Tabs/__stories__/Tabs.stories.d.ts +9 -0
- package/dist/src/components/molecules/Tabs/__stories__/Tabs.stories.js +103 -0
- package/dist/src/components/molecules/Tabs/i18n/en.json +3 -0
- package/dist/src/components/molecules/Tabs/i18n/index.d.ts +13 -0
- package/dist/src/components/molecules/Tabs/i18n/index.js +5 -0
- package/dist/src/components/molecules/Tabs/i18n/ru.json +3 -0
- package/dist/src/components/molecules/Tabs/index.d.ts +1 -0
- package/dist/src/components/molecules/Tabs/index.js +1 -0
- package/dist/src/components/molecules/ToolFooter/__stories__/ToolFooter.stories.d.ts +7 -0
- package/dist/src/components/molecules/ToolFooter/__stories__/ToolFooter.stories.js +58 -0
- package/dist/src/components/molecules/ToolFooter/index.d.ts +3 -0
- package/dist/src/components/molecules/ToolFooter/index.js +10 -0
- package/dist/src/components/molecules/ToolHeader/__stories__/ToolHeader.stories.d.ts +7 -0
- package/dist/src/components/molecules/ToolHeader/__stories__/ToolHeader.stories.js +55 -0
- package/dist/src/components/molecules/ToolHeader/index.d.ts +3 -0
- package/dist/src/components/molecules/ToolHeader/index.js +19 -0
- package/dist/src/components/molecules/index.d.ts +11 -0
- package/dist/src/components/molecules/index.js +12 -0
- package/dist/src/components/organisms/AssistantMessage/AssistantMessage.d.ts +14 -0
- package/dist/src/components/organisms/AssistantMessage/AssistantMessage.js +31 -0
- package/dist/src/components/organisms/AssistantMessage/__stories__/AssistantMessage.stories.d.ts +13 -0
- package/dist/src/components/organisms/AssistantMessage/__stories__/AssistantMessage.stories.js +151 -0
- package/dist/src/components/organisms/AssistantMessage/defaultMessageTypeRegistry.d.ts +3 -0
- package/dist/src/components/organisms/AssistantMessage/defaultMessageTypeRegistry.js +18 -0
- package/dist/src/components/organisms/AssistantMessage/index.d.ts +1 -0
- package/dist/src/components/organisms/AssistantMessage/index.js +1 -0
- package/dist/src/components/organisms/Header/Header.d.ts +9 -0
- package/dist/src/components/organisms/Header/Header.js +65 -0
- package/dist/src/components/organisms/Header/__stories__/Header.stories.d.ts +13 -0
- package/dist/src/components/organisms/Header/__stories__/Header.stories.js +130 -0
- package/dist/src/components/organisms/Header/i18n/en.json +7 -0
- package/dist/src/components/organisms/Header/i18n/index.d.ts +13 -0
- package/dist/src/components/organisms/Header/i18n/index.js +5 -0
- package/dist/src/components/organisms/Header/i18n/ru.json +7 -0
- package/dist/src/components/organisms/Header/index.d.ts +4 -0
- package/dist/src/components/organisms/Header/index.js +6 -0
- package/dist/src/components/organisms/Header/types.d.ts +23 -0
- package/dist/src/components/organisms/Header/types.js +7 -0
- package/dist/src/components/organisms/Header/useHeader.d.ts +21 -0
- package/dist/src/components/organisms/Header/useHeader.js +71 -0
- package/dist/src/components/organisms/MessageList/ErrorAlert.d.ts +6 -0
- package/dist/src/components/organisms/MessageList/ErrorAlert.js +15 -0
- package/dist/src/components/organisms/MessageList/MessageList.d.ts +20 -0
- package/dist/src/components/organisms/MessageList/MessageList.js +21 -0
- package/dist/src/components/organisms/MessageList/__stories__/MessageList.stories.d.ts +22 -0
- package/dist/src/components/organisms/MessageList/__stories__/MessageList.stories.js +168 -0
- package/dist/src/components/organisms/MessageList/i18n/en.json +4 -0
- package/dist/src/components/organisms/MessageList/i18n/index.d.ts +13 -0
- package/dist/src/components/organisms/MessageList/i18n/index.js +5 -0
- package/dist/src/components/organisms/MessageList/i18n/ru.json +4 -0
- package/dist/src/components/organisms/MessageList/index.d.ts +1 -0
- package/dist/src/components/organisms/MessageList/index.js +1 -0
- package/dist/src/components/organisms/PromptInput/PromptInput.d.ts +44 -0
- package/dist/src/components/organisms/PromptInput/PromptInput.js +38 -0
- package/dist/src/components/organisms/PromptInput/PromptInputFull.d.ts +26 -0
- package/dist/src/components/organisms/PromptInput/PromptInputFull.js +25 -0
- package/dist/src/components/organisms/PromptInput/PromptInputSimple.d.ts +24 -0
- package/dist/src/components/organisms/PromptInput/PromptInputSimple.js +21 -0
- package/dist/src/components/organisms/PromptInput/PromptInputWithPanels.d.ts +24 -0
- package/dist/src/components/organisms/PromptInput/PromptInputWithPanels.js +19 -0
- package/dist/src/components/organisms/PromptInput/PromptInputWithSuggestions.d.ts +22 -0
- package/dist/src/components/organisms/PromptInput/PromptInputWithSuggestions.js +16 -0
- package/dist/src/components/organisms/PromptInput/__stories__/PromptInput.stories.d.ts +18 -0
- package/dist/src/components/organisms/PromptInput/__stories__/PromptInput.stories.js +278 -0
- package/dist/src/components/organisms/PromptInput/index.d.ts +8 -0
- package/dist/src/components/organisms/PromptInput/index.js +7 -0
- package/dist/src/components/organisms/PromptInput/types.d.ts +72 -0
- package/dist/src/components/organisms/PromptInput/types.js +1 -0
- package/dist/src/components/organisms/PromptInput/useDelayedUnmount.d.ts +8 -0
- package/dist/src/components/organisms/PromptInput/useDelayedUnmount.js +26 -0
- package/dist/src/components/organisms/PromptInput/usePromptInput.d.ts +52 -0
- package/dist/src/components/organisms/PromptInput/usePromptInput.js +102 -0
- package/dist/src/components/organisms/ThinkingMessage/__stories__/ThinkingMessage.stories.d.ts +12 -0
- package/dist/src/components/organisms/ThinkingMessage/__stories__/ThinkingMessage.stories.js +107 -0
- package/dist/src/components/organisms/ThinkingMessage/i18n/en.json +4 -0
- package/dist/src/components/organisms/ThinkingMessage/i18n/index.d.ts +13 -0
- package/dist/src/components/organisms/ThinkingMessage/i18n/index.js +5 -0
- package/dist/src/components/organisms/ThinkingMessage/i18n/ru.json +4 -0
- package/dist/src/components/organisms/ThinkingMessage/index.d.ts +24 -0
- package/dist/src/components/organisms/ThinkingMessage/index.js +34 -0
- package/dist/src/components/organisms/ThinkingMessage/useThinkingMessage.d.ts +18 -0
- package/dist/src/components/organisms/ThinkingMessage/useThinkingMessage.js +23 -0
- package/dist/src/components/organisms/ToolMessage/__stories__/ToolMessage.stories.d.ts +11 -0
- package/dist/src/components/organisms/ToolMessage/__stories__/ToolMessage.stories.js +70 -0
- package/dist/src/components/organisms/ToolMessage/i18n/en.json +9 -0
- package/dist/src/components/organisms/ToolMessage/i18n/index.d.ts +13 -0
- package/dist/src/components/organisms/ToolMessage/i18n/index.js +5 -0
- package/dist/src/components/organisms/ToolMessage/i18n/ru.json +9 -0
- package/dist/src/components/organisms/ToolMessage/index.d.ts +3 -0
- package/dist/src/components/organisms/ToolMessage/index.js +12 -0
- package/dist/src/components/organisms/UserMessage/__stories__/UserMessage.stories.d.ts +7 -0
- package/dist/src/components/organisms/UserMessage/__stories__/UserMessage.stories.js +70 -0
- package/dist/src/components/organisms/UserMessage/index.d.ts +13 -0
- package/dist/src/components/organisms/UserMessage/index.js +12 -0
- package/dist/src/components/organisms/index.d.ts +7 -0
- package/dist/src/components/organisms/index.js +8 -0
- package/dist/src/components/pages/ChatContainer/ChatContainer.d.ts +10 -0
- package/dist/src/components/pages/ChatContainer/ChatContainer.js +110 -0
- package/dist/src/components/pages/ChatContainer/__stories__/ChatContainer.stories.d.ts +53 -0
- package/dist/src/components/pages/ChatContainer/__stories__/ChatContainer.stories.js +707 -0
- package/dist/src/components/pages/ChatContainer/i18n/en.json +10 -0
- package/dist/src/components/pages/ChatContainer/i18n/index.d.ts +13 -0
- package/dist/src/components/pages/ChatContainer/i18n/index.js +5 -0
- package/dist/src/components/pages/ChatContainer/i18n/ru.json +10 -0
- package/dist/src/components/pages/ChatContainer/index.d.ts +2 -0
- package/dist/src/components/pages/ChatContainer/index.js +1 -0
- package/dist/src/components/pages/ChatContainer/types.d.ts +143 -0
- package/dist/src/components/pages/ChatContainer/types.js +1 -0
- package/dist/src/components/pages/ChatContainer/useChatContainer.d.ts +20 -0
- package/dist/src/components/pages/ChatContainer/useChatContainer.js +77 -0
- package/dist/src/components/pages/index.d.ts +1 -0
- package/dist/src/components/pages/index.js +2 -0
- package/dist/src/components/templates/ChatContent/ChatContent.d.ts +29 -0
- package/dist/src/components/templates/ChatContent/ChatContent.js +19 -0
- package/dist/src/components/templates/ChatContent/__stories__/ChatContent.stories.d.ts +14 -0
- package/dist/src/components/templates/ChatContent/__stories__/ChatContent.stories.js +315 -0
- package/dist/src/components/templates/ChatContent/index.d.ts +1 -0
- package/dist/src/components/templates/ChatContent/index.js +1 -0
- package/dist/src/components/templates/EmptyContainer/EmptyContainer.d.ts +57 -0
- package/dist/src/components/templates/EmptyContainer/EmptyContainer.js +26 -0
- package/dist/src/components/templates/EmptyContainer/__stories__/EmptyContainer.stories.d.ts +20 -0
- package/dist/src/components/templates/EmptyContainer/__stories__/EmptyContainer.stories.js +250 -0
- package/dist/src/components/templates/EmptyContainer/i18n/en.json +3 -0
- package/dist/src/components/templates/EmptyContainer/i18n/index.d.ts +13 -0
- package/dist/src/components/templates/EmptyContainer/i18n/index.js +5 -0
- package/dist/src/components/templates/EmptyContainer/i18n/ru.json +3 -0
- package/dist/src/components/templates/EmptyContainer/index.d.ts +1 -0
- package/dist/src/components/templates/EmptyContainer/index.js +1 -0
- package/dist/src/components/templates/History/ChatItem.d.ts +17 -0
- package/dist/src/components/templates/History/ChatItem.js +18 -0
- package/dist/src/components/templates/History/DateHeaderItem.d.ts +12 -0
- package/dist/src/components/templates/History/DateHeaderItem.js +12 -0
- package/dist/src/components/templates/History/History.d.ts +46 -0
- package/dist/src/components/templates/History/History.js +16 -0
- package/dist/src/components/templates/History/HistoryList.d.ts +43 -0
- package/dist/src/components/templates/History/HistoryList.js +87 -0
- package/dist/src/components/templates/History/__stories__/History.stories.d.ts +17 -0
- package/dist/src/components/templates/History/__stories__/History.stories.js +281 -0
- package/dist/src/components/templates/History/i18n/en.json +7 -0
- package/dist/src/components/templates/History/i18n/index.d.ts +13 -0
- package/dist/src/components/templates/History/i18n/index.js +5 -0
- package/dist/src/components/templates/History/i18n/ru.json +7 -0
- package/dist/src/components/templates/History/index.d.ts +8 -0
- package/dist/src/components/templates/History/index.js +4 -0
- package/dist/src/components/templates/index.d.ts +3 -0
- package/dist/src/components/templates/index.js +4 -0
- package/dist/src/constants/index.d.ts +1 -0
- package/dist/src/constants/index.js +1 -0
- package/dist/src/demo/ContentWrapper/ContentWrapper.d.ts +7 -0
- package/dist/src/demo/ContentWrapper/ContentWrapper.js +7 -0
- package/dist/src/demo/ContentWrapper/index.d.ts +1 -0
- package/dist/src/demo/ContentWrapper/index.js +1 -0
- package/dist/src/demo/DocsDecorator/DocsDecorator.d.ts +6 -0
- package/dist/src/demo/DocsDecorator/DocsDecorator.js +12 -0
- package/dist/src/demo/DocsDecorator/ThemeContext.d.ts +2 -0
- package/dist/src/demo/DocsDecorator/ThemeContext.js +2 -0
- package/dist/src/demo/Showcase/Showcase.d.ts +9 -0
- package/dist/src/demo/Showcase/Showcase.js +7 -0
- package/dist/src/demo/Showcase/index.d.ts +1 -0
- package/dist/src/demo/Showcase/index.js +1 -0
- package/dist/src/demo/ShowcaseItem/ShowcaseItem.d.ts +7 -0
- package/dist/src/demo/ShowcaseItem/ShowcaseItem.js +7 -0
- package/dist/src/demo/ShowcaseItem/index.d.ts +1 -0
- package/dist/src/demo/ShowcaseItem/index.js +1 -0
- package/dist/src/demo/SwapArea/SwapArea.d.ts +2 -0
- package/dist/src/demo/SwapArea/SwapArea.js +7 -0
- package/dist/src/demo/SwapArea/index.d.ts +1 -0
- package/dist/src/demo/SwapArea/index.js +1 -0
- package/dist/src/hooks/index.d.ts +2 -0
- package/dist/src/hooks/index.js +2 -0
- package/dist/src/hooks/useDateFormatter/index.d.ts +34 -0
- package/dist/src/hooks/useDateFormatter/index.js +101 -0
- package/dist/src/hooks/useToolMessage.d.ts +11 -0
- package/dist/src/hooks/useToolMessage.js +96 -0
- package/dist/src/index.d.ts +11 -0
- package/dist/src/index.js +19 -0
- package/dist/src/types/chat.d.ts +17 -0
- package/dist/src/types/chat.js +1 -0
- package/dist/src/types/common.d.ts +7 -0
- package/dist/src/types/common.js +1 -0
- package/dist/src/types/index.d.ts +4 -0
- package/dist/src/types/index.js +4 -0
- package/dist/src/types/messages.d.ts +62 -0
- package/dist/src/types/messages.js +1 -0
- package/dist/src/types/tool.d.ts +34 -0
- package/dist/src/types/tool.js +1 -0
- package/dist/src/utils/chatUtils.d.ts +23 -0
- package/dist/src/utils/chatUtils.js +43 -0
- package/dist/src/utils/cn.d.ts +11 -0
- package/dist/src/utils/cn.js +12 -0
- package/dist/src/utils/index.d.ts +4 -0
- package/dist/src/utils/index.js +5 -0
- package/dist/src/utils/messageTypeRegistry.d.ts +13 -0
- package/dist/src/utils/messageTypeRegistry.js +16 -0
- package/dist/src/utils/messageUtils.d.ts +4 -0
- package/dist/src/utils/messageUtils.js +25 -0
- package/dist/src/utils/validation.d.ts +16 -0
- package/dist/src/utils/validation.js +24 -0
- package/package.json +111 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2023 YANDEX LLC
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
# @gravity-ui/aikit
|
|
2
|
+
|
|
3
|
+
UI component library for AI chats built with Atomic Design principles.
|
|
4
|
+
|
|
5
|
+
## Description
|
|
6
|
+
|
|
7
|
+
**@gravity-ui/aikit** is a flexible and extensible React component library for building AI chats of any complexity. The library provides a set of ready-made components that can be used as-is or customized to fit your needs.
|
|
8
|
+
|
|
9
|
+
### Key Features
|
|
10
|
+
|
|
11
|
+
- 🎨 **Atomic Design** — clear component hierarchy from atoms to pages
|
|
12
|
+
- 🔧 **SDK Agnostic** — independent of specific AI SDKs
|
|
13
|
+
- 🎭 **Two-Level Approach** — ready-made components + hooks for customization
|
|
14
|
+
- 🎨 **CSS Variables** — easy theming without component overrides
|
|
15
|
+
- 📦 **TypeScript** — full type safety out of the box
|
|
16
|
+
- 🔌 **Extensible** — custom message type registration system
|
|
17
|
+
|
|
18
|
+
## Project Structure
|
|
19
|
+
|
|
20
|
+
```
|
|
21
|
+
src/
|
|
22
|
+
├── components/
|
|
23
|
+
│ ├── atoms/ # Basic indivisible UI elements
|
|
24
|
+
│ ├── molecules/ # Simple groups of atoms
|
|
25
|
+
│ ├── organisms/ # Complex components with logic
|
|
26
|
+
│ ├── templates/ # Complete layouts
|
|
27
|
+
│ └── pages/ # Full integrations with data
|
|
28
|
+
├── hooks/ # General purpose hooks
|
|
29
|
+
├── types/ # TypeScript types
|
|
30
|
+
├── utils/ # Utilities
|
|
31
|
+
└── themes/ # CSS themes and variables
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
## Installation
|
|
35
|
+
|
|
36
|
+
```bash
|
|
37
|
+
npm install @gravity-ui/aikit
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Quick Start
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { ChatContainer } from '@gravity-ui/aikit';
|
|
44
|
+
import type { ChatType, TChatMessage } from '@gravity-ui/aikit';
|
|
45
|
+
|
|
46
|
+
function App() {
|
|
47
|
+
const [messages, setMessages] = useState<TChatMessage[]>([]);
|
|
48
|
+
const [chats, setChats] = useState<ChatType[]>([]);
|
|
49
|
+
const [activeChat, setActiveChat] = useState<ChatType | null>(null);
|
|
50
|
+
|
|
51
|
+
return (
|
|
52
|
+
<ChatContainer
|
|
53
|
+
chats={chats}
|
|
54
|
+
activeChat={activeChat}
|
|
55
|
+
messages={messages}
|
|
56
|
+
onSendMessage={async (data) => {
|
|
57
|
+
// Your sending logic
|
|
58
|
+
console.log('Message:', data.content);
|
|
59
|
+
}}
|
|
60
|
+
onSelectChat={setActiveChat}
|
|
61
|
+
onCreateChat={() => {
|
|
62
|
+
// Create new chat
|
|
63
|
+
}}
|
|
64
|
+
onDeleteChat={(chat) => {
|
|
65
|
+
// Delete chat
|
|
66
|
+
}}
|
|
67
|
+
/>
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
## Architecture
|
|
73
|
+
|
|
74
|
+
The library is built on **Atomic Design** principles:
|
|
75
|
+
|
|
76
|
+
### 🔹 Atoms
|
|
77
|
+
|
|
78
|
+
Basic indivisible UI elements without business logic:
|
|
79
|
+
|
|
80
|
+
- `ActionButton` — button with integrated tooltip
|
|
81
|
+
- `Alert` — alert messages with variants
|
|
82
|
+
- `ChatDate` — date formatting with relative dates
|
|
83
|
+
- `ContextIndicator` — token context usage indicator
|
|
84
|
+
- `ContextItem` — context label with remove action
|
|
85
|
+
- `DiffStat` — code change statistics display
|
|
86
|
+
- `Disclaimer` — disclaimer text component
|
|
87
|
+
- `InlineCitation` — text citations
|
|
88
|
+
- `Loader` — loading indicator
|
|
89
|
+
- `MarkdownRenderer` — Yandex Flavored Markdown renderer
|
|
90
|
+
- `MessageBalloon` — message wrapper
|
|
91
|
+
- `Shimmer` — loading animation effect
|
|
92
|
+
- `SubmitButton` — submit button with states
|
|
93
|
+
- `ToolIndicator` — tool execution status indicator
|
|
94
|
+
|
|
95
|
+
### 🔸 Molecules
|
|
96
|
+
|
|
97
|
+
Simple combinations of atoms:
|
|
98
|
+
|
|
99
|
+
- `BaseMessage` — base wrapper for all message types
|
|
100
|
+
- `ButtonGroup` — button group with orientation support
|
|
101
|
+
- `InputContext` — context management
|
|
102
|
+
- `PromptInputBody` — textarea with auto-growing
|
|
103
|
+
- `PromptInputFooter` — footer with action icons and submit button
|
|
104
|
+
- `PromptInputHeader` — header with context items and indicator
|
|
105
|
+
- `PromptInputPanel` — panel container for custom content
|
|
106
|
+
- `Suggestions` — clickable suggestion buttons
|
|
107
|
+
- `Tabs` — navigation tabs with delete functionality
|
|
108
|
+
- `ToolFooter` — tool message footer with actions
|
|
109
|
+
- `ToolHeader` — tool message header with icon and actions
|
|
110
|
+
|
|
111
|
+
### 🔶 Organisms
|
|
112
|
+
|
|
113
|
+
Complex components with internal logic:
|
|
114
|
+
|
|
115
|
+
- `AssistantMessage` — AI assistant message
|
|
116
|
+
- `Header` — chat header
|
|
117
|
+
- `MessageList` — message list
|
|
118
|
+
- `PromptInput` — message input field
|
|
119
|
+
- `ThinkingMessage` — AI thinking process
|
|
120
|
+
- `ToolMessage` — tool execution
|
|
121
|
+
- `UserMessage` — user message
|
|
122
|
+
|
|
123
|
+
### 📄 Templates
|
|
124
|
+
|
|
125
|
+
Complete layouts:
|
|
126
|
+
|
|
127
|
+
- `ChatContent` — main chat content
|
|
128
|
+
- `EmptyContainer` — empty state
|
|
129
|
+
- `History` — chat history
|
|
130
|
+
|
|
131
|
+
### 📱 Pages
|
|
132
|
+
|
|
133
|
+
Full integrations:
|
|
134
|
+
|
|
135
|
+
- `ChatContainer` — fully assembled chat
|
|
136
|
+
|
|
137
|
+
## Documentation
|
|
138
|
+
|
|
139
|
+
- [Quick Start Guide](./docs/GETTING_STARTED.md)
|
|
140
|
+
- [Architecture](./docs/ARCHITECTURE.md)
|
|
141
|
+
- [Project Structure](./docs/PROJECT_STRUCTURE.md)
|
|
142
|
+
- [Testing Guide](./docs/TESTING.md)
|
|
143
|
+
- [Playwright Guide](./playwright/README.md)
|
|
144
|
+
|
|
145
|
+
## Testing
|
|
146
|
+
|
|
147
|
+
The project uses Playwright Component Testing for visual regression testing.
|
|
148
|
+
|
|
149
|
+
### Run tests
|
|
150
|
+
|
|
151
|
+
**Important**: All tests must be run via Docker to ensure consistent screenshots across different environments.
|
|
152
|
+
|
|
153
|
+
```bash
|
|
154
|
+
# Run all component tests in Docker (recommended)
|
|
155
|
+
npm run playwright:docker
|
|
156
|
+
|
|
157
|
+
# Update screenshot baselines in Docker
|
|
158
|
+
npm run playwright:docker:update
|
|
159
|
+
|
|
160
|
+
# Run specific test by grep pattern in Docker
|
|
161
|
+
npm run playwright:docker -- --grep "@ComponentName"
|
|
162
|
+
|
|
163
|
+
# Clear Docker cache if needed
|
|
164
|
+
npm run playwright:docker:clear-cache
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
### Local testing (Linux only)
|
|
168
|
+
|
|
169
|
+
If you're on Linux, you can run tests locally:
|
|
170
|
+
|
|
171
|
+
```bash
|
|
172
|
+
# Install Playwright browsers (run once)
|
|
173
|
+
npm run playwright:install
|
|
174
|
+
|
|
175
|
+
# Run all component tests
|
|
176
|
+
npm run playwright
|
|
177
|
+
|
|
178
|
+
# Update screenshot baselines
|
|
179
|
+
npm run playwright:update
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
For detailed testing documentation, see [Playwright Guide](./playwright/README.md).
|
|
183
|
+
|
|
184
|
+
## Development
|
|
185
|
+
|
|
186
|
+
Development and contribution instructions are available in [CONTRIBUTING.md](./CONTRIBUTING.md).
|
|
187
|
+
|
|
188
|
+
## License
|
|
189
|
+
|
|
190
|
+
MIT
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export declare const ThemeLight: import("storybook/theming").ThemeVars;
|
|
2
|
+
export declare const ThemeDark: import("storybook/theming").ThemeVars;
|
|
3
|
+
export declare const themes: {
|
|
4
|
+
light: import("storybook/theming").ThemeVars;
|
|
5
|
+
dark: import("storybook/theming").ThemeVars;
|
|
6
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { create } from 'storybook/theming';
|
|
2
|
+
import pkg from '../package.json';
|
|
3
|
+
function renderBrandTitle(theme) {
|
|
4
|
+
const titleColor = theme === 'light' ? 'rgba(0, 0, 0, 0.85)' : 'rgba(255, 255, 255, 0.85)';
|
|
5
|
+
const descriptionColor = theme === 'light' ? 'rgba(0, 0, 0, 0.5)' : 'rgba(255, 255, 255, 0.5)';
|
|
6
|
+
const logo = '<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 125 125" width="32" height="32" fill="none"><path fill="url(#a)" fill-rule="evenodd" d="M103.064 103.055c23.649-23.649 23.649-61.991 0-85.64L86.058 34.421c13.898 14.429 13.84 37.285-.254 51.379s-36.95 14.152-51.38.254l-17 17.001c23.649 23.649 61.991 23.649 85.64 0" clip-rule="evenodd"/><mask id="b" width="125" height="126" x="0" y="-1" maskUnits="userSpaceOnUse" style="mask-type:alpha"><path fill="#F37" fill-rule="evenodd" d="M17.74 17.736C-2.88 38.356-5.521 70.147 9.817 93.63c1.09 1.733 1.635 2.599 1.95 3.41.727 1.874.832 3.422.363 5.377-.203.846-.721 1.984-1.757 4.26-3.458 7.596-4.205 13.244-1.578 15.87 7.412 7.413 31.148-4.306 70.301-43.459s50.872-62.89 43.46-70.302c-2.627-2.626-8.274-1.879-15.869 1.578-2.286 1.04-3.429 1.56-4.278 1.763-1.946.465-3.484.362-5.35-.357-.805-.31-1.665-.848-3.366-1.916C70.206-5.529 38.378-2.902 17.74 17.736m50.165 50.161c14.261-14.26 23.878-27.765 17.263-34.38-14.396-14.396-37.626-14.505-51.887-.244-14.261 14.26-14.152 37.491.244 51.887 6.615 6.615 20.12-3.002 34.38-17.263" clip-rule="evenodd"/></mask><g mask="url(#b)"><path fill="#F37" fill-rule="evenodd" d="M17.74 17.736C-2.88 38.356-5.521 70.147 9.817 93.63c1.09 1.733 1.635 2.599 1.95 3.41.727 1.874.832 3.422.363 5.377-.203.846-.721 1.984-1.757 4.26-3.458 7.596-4.205 13.244-1.578 15.87 7.412 7.413 31.148-4.306 70.301-43.459s50.872-62.89 43.46-70.302c-2.627-2.626-8.274-1.879-15.869 1.578-2.286 1.04-3.429 1.56-4.278 1.763-1.946.465-3.484.362-5.35-.357-.805-.31-1.665-.848-3.366-1.916C70.206-5.529 38.378-2.902 17.74 17.736m50.165 50.161c14.261-14.26 23.878-27.765 17.263-34.38-14.396-14.396-37.626-14.505-51.887-.244-14.261 14.26-14.152 37.491.244 51.887 6.615 6.615 20.12-3.002 34.38-17.263" clip-rule="evenodd"/><g filter="url(#c)"><path fill="#FF0" d="M19.03 88C6.426 68.68 8.597 42.522 25.543 25.556 42.507 8.572 68.673 6.412 87.978 19.08c1.388.873 2.093 1.313 2.753 1.567 1.533.592 2.797.677 4.396.295.698-.167 1.638-.595 3.516-1.451 6.242-2.845 14.999-8.953 18.072-5.877 4.72 4.726-9.484 29.292-41.662 61.507s-56.716 47.351-61.436 42.626c-3.074-3.077 3.028-12.76 5.87-19.01.852-1.873 1.277-2.81 1.444-3.505.386-1.609.3-2.882-.298-4.425-.259-.667-.707-1.38-1.604-2.805z"/></g></g><defs><radialGradient id="a" cx="0" cy="0" r="1" gradientTransform="rotate(45 -43.592 103.062)scale(59.7564)" gradientUnits="userSpaceOnUse"><stop offset=".646" stop-color="#FF0"/><stop offset="1" stop-color="#F37"/></radialGradient><filter id="c" width="144.672" height="145.669" x="-8.053" y="-8.056" color-interpolation-filters="sRGB" filterUnits="userSpaceOnUse"><feFlood flood-opacity="0" result="BackgroundImageFix"/><feBlend in="SourceGraphic" in2="BackgroundImageFix" result="shape"/><feGaussianBlur result="effect1_foregroundBlur_1776_29897" stdDeviation="9.509"/></filter></defs></svg>';
|
|
7
|
+
return `
|
|
8
|
+
<div style="display: flex; align-items: flex-start">
|
|
9
|
+
<div style="flex-shrink: 0; line-height: 0">${logo}</div>
|
|
10
|
+
<div style="margin-inline-start: 8px">
|
|
11
|
+
<div style="font-size: 26px; line-height: 32px; color: ${titleColor}; font-weight: 600;">Gravity UI</div>
|
|
12
|
+
<div style="font-size: 14px; color: ${descriptionColor}; font-weight: 400;">AIKit v${pkg.version}</div>
|
|
13
|
+
</div>
|
|
14
|
+
</div>
|
|
15
|
+
`.trim();
|
|
16
|
+
}
|
|
17
|
+
const common = {
|
|
18
|
+
// Typography
|
|
19
|
+
fontBase: '"Helvetica Neue", Arial, Helvetica, sans-serif',
|
|
20
|
+
fontCode: '"SF Mono", "Menlo", "Monaco", "Consolas", "Ubuntu Mono", "Liberation Mono", "DejaVu Sans Mono", "Courier New", "Courier", monospace',
|
|
21
|
+
brandUrl: 'https://gravity-ui.com/',
|
|
22
|
+
};
|
|
23
|
+
export const ThemeLight = create(Object.assign(Object.assign({ base: 'light' }, common), { brandTitle: renderBrandTitle('light') }));
|
|
24
|
+
export const ThemeDark = create(Object.assign(Object.assign({ base: 'dark' }, common), { brandTitle: renderBrandTitle('dark') }));
|
|
25
|
+
export const themes = {
|
|
26
|
+
light: ThemeLight,
|
|
27
|
+
dark: ThemeDark,
|
|
28
|
+
};
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@gravity-ui/aikit",
|
|
3
|
+
"version": "0.0.1",
|
|
4
|
+
"description": "",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist"
|
|
9
|
+
],
|
|
10
|
+
"repository": {
|
|
11
|
+
"type": "git",
|
|
12
|
+
"url": "git+https://github.com/gravity-ui/aikit.git"
|
|
13
|
+
},
|
|
14
|
+
"bugs": {
|
|
15
|
+
"url": "https://github.com/gravity-ui/aikit/issues"
|
|
16
|
+
},
|
|
17
|
+
"homepage": "https://github.com/gravity-ui/aikit#readme",
|
|
18
|
+
"scripts": {
|
|
19
|
+
"prepare": "husky",
|
|
20
|
+
"lint:js": "eslint --ext .js,.jsx,.ts,.tsx .",
|
|
21
|
+
"lint:styles": "stylelint 'src/**/*.scss'",
|
|
22
|
+
"lint": "run-p lint:js lint:styles lint:prettier typecheck",
|
|
23
|
+
"typecheck": "tsc --noEmit",
|
|
24
|
+
"lint:fix": "run-s lint:js:fix lint:styles:fix lint:prettier:fix typecheck",
|
|
25
|
+
"lint:js:fix": "eslint '**/*.{js,jsx,ts,tsx}' --max-warnings=0 --quiet --fix",
|
|
26
|
+
"lint:styles:fix": "stylelint **/*.scss --fix",
|
|
27
|
+
"lint:prettier": "prettier --check '**/*.{js,jsx,ts,tsx,css,scss,json,yaml,yml,md,mdx}'",
|
|
28
|
+
"lint:prettier:fix": "prettier --write '**/*.{js,jsx,ts,tsx,css,scss,json,yaml,yml,md,mdx}'",
|
|
29
|
+
"test": "jest --passWithNoTests",
|
|
30
|
+
"build": "tsc",
|
|
31
|
+
"start": "TS_NODE_PROJECT=.storybook/tsconfig.json storybook dev",
|
|
32
|
+
"prepublishOnly": "npm run build",
|
|
33
|
+
"playwright:install": "playwright install chromium webkit --with-deps",
|
|
34
|
+
"playwright": "playwright test --config=playwright-ct.config.ts",
|
|
35
|
+
"playwright:update": "npm run playwright -- -u all",
|
|
36
|
+
"playwright:clear-cache": "rm -rf ./playwright/.cache",
|
|
37
|
+
"playwright:docker": "./playwright/run-docker-command.sh npm run playwright --",
|
|
38
|
+
"playwright:docker:update": "./playwright/run-docker-command.sh npm run playwright:update --",
|
|
39
|
+
"playwright:docker:clear-cache": "./playwright/run-docker-command.sh clear-cache"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@babel/preset-env": "^7.28.5",
|
|
43
|
+
"@babel/preset-react": "^7.28.5",
|
|
44
|
+
"@babel/preset-typescript": "^7.28.5",
|
|
45
|
+
"@commitlint/cli": "^19.0.3",
|
|
46
|
+
"@commitlint/config-conventional": "^19.0.3",
|
|
47
|
+
"@gravity-ui/eslint-config": "^3.1.1",
|
|
48
|
+
"@gravity-ui/prettier-config": "^1.1.0",
|
|
49
|
+
"@gravity-ui/stylelint-config": "^4.0.1",
|
|
50
|
+
"@gravity-ui/tsconfig": "^1.0.0",
|
|
51
|
+
"@playwright/experimental-ct-react": "^1.56.1",
|
|
52
|
+
"@playwright/test": "^1.56.1",
|
|
53
|
+
"@storybook/addon-docs": "^9.0.5",
|
|
54
|
+
"@storybook/addon-styling-webpack": "^2.0.0",
|
|
55
|
+
"@storybook/addon-webpack5-compiler-babel": "^3.0.6",
|
|
56
|
+
"@storybook/preset-scss": "^1.0.3",
|
|
57
|
+
"@storybook/react-webpack5": "^9.0.5",
|
|
58
|
+
"@testing-library/dom": "^10.4.1",
|
|
59
|
+
"@testing-library/jest-dom": "^6.9.1",
|
|
60
|
+
"@testing-library/react": "^16.3.0",
|
|
61
|
+
"@types/jest": "^29.5.12",
|
|
62
|
+
"@types/react": "^18.2.64",
|
|
63
|
+
"@types/react-dom": "^18.2.21",
|
|
64
|
+
"@types/uuid": "^11.0.0",
|
|
65
|
+
"eslint": "^8.57.0",
|
|
66
|
+
"eslint-plugin-storybook": "^9.0.5",
|
|
67
|
+
"husky": "^9.0.11",
|
|
68
|
+
"jest": "^29.7.0",
|
|
69
|
+
"jest-environment-jsdom": "^30.2.0",
|
|
70
|
+
"nano-staged": "^0.8.0",
|
|
71
|
+
"npm-run-all": "^4.1.5",
|
|
72
|
+
"prettier": "^3.2.5",
|
|
73
|
+
"process": "^0.11.10",
|
|
74
|
+
"react": "^18.2.0",
|
|
75
|
+
"react-dom": "^18.2.0",
|
|
76
|
+
"sass": "^1.71.1",
|
|
77
|
+
"sass-loader": "^14.1.1",
|
|
78
|
+
"storybook": "^9.0.5",
|
|
79
|
+
"storybook-addon-mock-date": "^1.0.2",
|
|
80
|
+
"style-loader": "^3.3.4",
|
|
81
|
+
"stylelint": "^15.11.0",
|
|
82
|
+
"ts-jest": "^29.1.2",
|
|
83
|
+
"typescript": "^5.4.2"
|
|
84
|
+
},
|
|
85
|
+
"peerDependencies": {
|
|
86
|
+
"react": "^18.2.0",
|
|
87
|
+
"react-dom": "^18.2.0"
|
|
88
|
+
},
|
|
89
|
+
"nano-staged": {
|
|
90
|
+
"*.{scss}": [
|
|
91
|
+
"stylelint --fix --quiet"
|
|
92
|
+
],
|
|
93
|
+
"*.{js,jsx,ts,tsx}": [
|
|
94
|
+
"eslint --fix --quiet"
|
|
95
|
+
],
|
|
96
|
+
"*.{md,mdx}": [
|
|
97
|
+
"prettier --write"
|
|
98
|
+
]
|
|
99
|
+
},
|
|
100
|
+
"dependencies": {
|
|
101
|
+
"@bem-react/classname": "^1.7.0",
|
|
102
|
+
"@diplodoc/transform": "^4.63.3",
|
|
103
|
+
"@gravity-ui/i18n": "^1.8.0",
|
|
104
|
+
"@gravity-ui/icons": "^2.16.0",
|
|
105
|
+
"@gravity-ui/uikit": "^7.25.0",
|
|
106
|
+
"dayjs": "^1.11.19",
|
|
107
|
+
"highlight.js": "^11.11.1",
|
|
108
|
+
"react-window": "^2.2.1",
|
|
109
|
+
"uuid": "^13.0.0"
|
|
110
|
+
}
|
|
111
|
+
}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ActionTooltipProps, ButtonButtonProps } from '@gravity-ui/uikit';
|
|
3
|
+
export interface ActionButtonProps extends Omit<ButtonButtonProps, 'className'> {
|
|
4
|
+
/**
|
|
5
|
+
* Button content (icon, text, or any ReactNode)
|
|
6
|
+
*/
|
|
7
|
+
children?: React.ReactNode;
|
|
8
|
+
/**
|
|
9
|
+
* Additional CSS class for the button
|
|
10
|
+
*/
|
|
11
|
+
className?: string;
|
|
12
|
+
/**
|
|
13
|
+
* Tooltip title text
|
|
14
|
+
*/
|
|
15
|
+
tooltipTitle?: ActionTooltipProps['title'];
|
|
16
|
+
/**
|
|
17
|
+
* Tooltip placement
|
|
18
|
+
*/
|
|
19
|
+
tooltipPlacement?: ActionTooltipProps['placement'];
|
|
20
|
+
/**
|
|
21
|
+
* Tooltip disabled state
|
|
22
|
+
*/
|
|
23
|
+
tooltipDisabled?: ActionTooltipProps['disabled'];
|
|
24
|
+
/**
|
|
25
|
+
* Tooltip open delay in ms
|
|
26
|
+
*/
|
|
27
|
+
tooltipOpenDelay?: ActionTooltipProps['openDelay'];
|
|
28
|
+
/**
|
|
29
|
+
* Tooltip close delay in ms
|
|
30
|
+
*/
|
|
31
|
+
tooltipCloseDelay?: ActionTooltipProps['closeDelay'];
|
|
32
|
+
/**
|
|
33
|
+
* Additional CSS class for the wrapper
|
|
34
|
+
*/
|
|
35
|
+
wrapperClassName?: string;
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* ActionButton component combines Button with ActionTooltip
|
|
39
|
+
*
|
|
40
|
+
* This component wraps a Button inside an ActionTooltip, providing
|
|
41
|
+
* a convenient way to add tooltips to action buttons throughout the application.
|
|
42
|
+
*
|
|
43
|
+
* @param props - Component props
|
|
44
|
+
* @param ref - Forwarded ref to the button element
|
|
45
|
+
* @returns ActionButton component
|
|
46
|
+
*/
|
|
47
|
+
export declare const ActionButton: React.ForwardRefExoticComponent<ActionButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
2
|
+
var t = {};
|
|
3
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
4
|
+
t[p] = s[p];
|
|
5
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
6
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
7
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
8
|
+
t[p[i]] = s[p[i]];
|
|
9
|
+
}
|
|
10
|
+
return t;
|
|
11
|
+
};
|
|
12
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
13
|
+
import React from 'react';
|
|
14
|
+
import { ActionTooltip, Button } from '@gravity-ui/uikit';
|
|
15
|
+
/**
|
|
16
|
+
* ActionButton component combines Button with ActionTooltip
|
|
17
|
+
*
|
|
18
|
+
* This component wraps a Button inside an ActionTooltip, providing
|
|
19
|
+
* a convenient way to add tooltips to action buttons throughout the application.
|
|
20
|
+
*
|
|
21
|
+
* @param props - Component props
|
|
22
|
+
* @param ref - Forwarded ref to the button element
|
|
23
|
+
* @returns ActionButton component
|
|
24
|
+
*/
|
|
25
|
+
export const ActionButton = React.forwardRef((_a, ref) => {
|
|
26
|
+
var { tooltipTitle, tooltipPlacement, tooltipDisabled, tooltipOpenDelay, tooltipCloseDelay, wrapperClassName, className, children } = _a, buttonProps = __rest(_a, ["tooltipTitle", "tooltipPlacement", "tooltipDisabled", "tooltipOpenDelay", "tooltipCloseDelay", "wrapperClassName", "className", "children"]);
|
|
27
|
+
const button = (_jsx(Button, Object.assign({}, buttonProps, { ref: ref, className: className, children: children })));
|
|
28
|
+
// If no tooltip props provided, return button without tooltip
|
|
29
|
+
if (!tooltipTitle) {
|
|
30
|
+
return button;
|
|
31
|
+
}
|
|
32
|
+
return (_jsx(ActionTooltip, { title: tooltipTitle, placement: tooltipPlacement, disabled: tooltipDisabled, openDelay: tooltipOpenDelay, closeDelay: tooltipCloseDelay, className: wrapperClassName, children: button }));
|
|
33
|
+
});
|
|
34
|
+
ActionButton.displayName = 'ActionButton';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { ActionButton } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
type Story = StoryObj<typeof ActionButton>;
|
|
6
|
+
export declare const Playground: Story;
|
|
7
|
+
export declare const Default: Story;
|
|
8
|
+
export declare const WithoutTooltip: Story;
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Copy, Pencil } from '@gravity-ui/icons';
|
|
3
|
+
import { Icon } from '@gravity-ui/uikit';
|
|
4
|
+
import { ActionButton } from '..';
|
|
5
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
6
|
+
import MDXDocs from './Docs.mdx';
|
|
7
|
+
export default {
|
|
8
|
+
title: 'atoms/ActionButton',
|
|
9
|
+
component: ActionButton,
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
page: MDXDocs,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const defaultDecorators = [
|
|
17
|
+
(Story) => (_jsx(ContentWrapper, { children: _jsx(Story, {}) })),
|
|
18
|
+
];
|
|
19
|
+
const mockOnClick = () => {
|
|
20
|
+
// eslint-disable-next-line no-console
|
|
21
|
+
console.log('Button clicked');
|
|
22
|
+
};
|
|
23
|
+
export const Playground = {
|
|
24
|
+
args: {
|
|
25
|
+
tooltipTitle: 'Copy',
|
|
26
|
+
view: 'flat',
|
|
27
|
+
size: 'm',
|
|
28
|
+
children: _jsx(Icon, { data: Copy, size: 16 }),
|
|
29
|
+
onClick: mockOnClick,
|
|
30
|
+
},
|
|
31
|
+
decorators: defaultDecorators,
|
|
32
|
+
};
|
|
33
|
+
export const Default = {
|
|
34
|
+
args: {
|
|
35
|
+
tooltipTitle: 'Edit',
|
|
36
|
+
children: _jsx(Icon, { data: Pencil, size: 16 }),
|
|
37
|
+
onClick: mockOnClick,
|
|
38
|
+
},
|
|
39
|
+
decorators: defaultDecorators,
|
|
40
|
+
};
|
|
41
|
+
export const WithoutTooltip = {
|
|
42
|
+
args: {
|
|
43
|
+
children: _jsx(Icon, { data: Copy, size: 16 }),
|
|
44
|
+
view: 'outlined',
|
|
45
|
+
onClick: mockOnClick,
|
|
46
|
+
},
|
|
47
|
+
decorators: defaultDecorators,
|
|
48
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { ActionButton } from './ActionButton';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { AlertProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<AlertProps>;
|
|
6
|
+
export declare const Variant: StoryObj<AlertProps>;
|
|
7
|
+
export declare const Action: StoryFn<AlertProps>;
|
|
8
|
+
export declare const LongText: StoryFn<AlertProps>;
|
|
9
|
+
export declare const CustomIcon: StoryFn<AlertProps>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Arrows3RotateLeft } from '@gravity-ui/icons';
|
|
3
|
+
import { Icon } from '@gravity-ui/uikit';
|
|
4
|
+
import { Alert } 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: 'atoms/Alert',
|
|
11
|
+
component: Alert,
|
|
12
|
+
parameters: {
|
|
13
|
+
docs: {
|
|
14
|
+
page: MDXDocs,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
argTypes: {
|
|
18
|
+
className: {
|
|
19
|
+
control: 'text',
|
|
20
|
+
description: 'Additional CSS class',
|
|
21
|
+
},
|
|
22
|
+
qa: {
|
|
23
|
+
control: 'text',
|
|
24
|
+
description: 'QA/test identifier',
|
|
25
|
+
},
|
|
26
|
+
},
|
|
27
|
+
};
|
|
28
|
+
const defaultDecorators = [
|
|
29
|
+
(Story) => (_jsx(ContentWrapper, { children: _jsx(Showcase, { children: _jsx(Story, {}) }) })),
|
|
30
|
+
];
|
|
31
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(Alert, Object.assign({}, args)) }));
|
|
32
|
+
Playground.args = {
|
|
33
|
+
text: 'Alert message',
|
|
34
|
+
variant: 'default',
|
|
35
|
+
};
|
|
36
|
+
export const Variant = {
|
|
37
|
+
render: (args) => (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "Default", children: _jsx(Alert, Object.assign({}, args, { variant: "default" })) }), _jsx(ShowcaseItem, { title: "Info", children: _jsx(Alert, Object.assign({}, args, { variant: "info" })) }), _jsx(ShowcaseItem, { title: "Warning", children: _jsx(Alert, Object.assign({}, args, { variant: "warning" })) }), _jsx(ShowcaseItem, { title: "Error", children: _jsx(Alert, Object.assign({}, args, { variant: "error" })) })] })),
|
|
38
|
+
decorators: defaultDecorators,
|
|
39
|
+
args: { text: 'Alert message' },
|
|
40
|
+
};
|
|
41
|
+
export const Action = (args) => (_jsx(ContentWrapper, { children: _jsx(Alert, Object.assign({}, args, { button: { content: 'Retry', onClick: () => ({}) } })) }));
|
|
42
|
+
Action.args = {
|
|
43
|
+
text: 'Alert message',
|
|
44
|
+
variant: 'default',
|
|
45
|
+
};
|
|
46
|
+
export const LongText = (args) => (_jsx(ContentWrapper, { children: _jsx(Alert, Object.assign({}, args, { button: { content: 'Retry', onClick: () => ({}) } })) }));
|
|
47
|
+
LongText.args = {
|
|
48
|
+
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
|
|
49
|
+
variant: 'warning',
|
|
50
|
+
};
|
|
51
|
+
export const CustomIcon = (args) => (_jsx(ContentWrapper, { children: _jsx(Alert, Object.assign({}, args, { icon: _jsx(Icon, { data: Arrows3RotateLeft, size: 20 }) })) }));
|
|
52
|
+
CustomIcon.args = {
|
|
53
|
+
text: 'Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum',
|
|
54
|
+
variant: 'default',
|
|
55
|
+
button: { content: 'Retry', onClick: () => ({}) },
|
|
56
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import './Alert.scss';
|
|
2
|
+
export interface AlertProps {
|
|
3
|
+
text: string;
|
|
4
|
+
variant?: 'default' | 'warning' | 'error' | 'info';
|
|
5
|
+
icon?: React.ReactNode;
|
|
6
|
+
button?: {
|
|
7
|
+
content: React.ReactNode;
|
|
8
|
+
onClick: () => void;
|
|
9
|
+
};
|
|
10
|
+
className?: string;
|
|
11
|
+
qa?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function Alert({ text, icon, button, variant, className, qa }: AlertProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import { CircleExclamationFill, CircleInfoFill, TriangleExclamationFill } from '@gravity-ui/icons';
|
|
4
|
+
import { Button, Icon, Text } from '@gravity-ui/uikit';
|
|
5
|
+
import { block } from '../../../utils/cn';
|
|
6
|
+
import './Alert.scss';
|
|
7
|
+
const b = block('alert');
|
|
8
|
+
const statusIcons = {
|
|
9
|
+
info: CircleInfoFill,
|
|
10
|
+
warning: TriangleExclamationFill,
|
|
11
|
+
error: CircleExclamationFill,
|
|
12
|
+
};
|
|
13
|
+
export function Alert({ text, icon, button, variant = 'default', className, qa }) {
|
|
14
|
+
const statusIcon = useMemo(() => {
|
|
15
|
+
if (icon) {
|
|
16
|
+
return _jsx("div", { className: b('icon'), children: icon });
|
|
17
|
+
}
|
|
18
|
+
const iconData = variant ? statusIcons[variant] : null;
|
|
19
|
+
if (iconData) {
|
|
20
|
+
return _jsx(Icon, { data: iconData, size: 14, className: b('icon', { variant }) });
|
|
21
|
+
}
|
|
22
|
+
return null;
|
|
23
|
+
}, [icon, variant]);
|
|
24
|
+
return (_jsxs("div", { className: b(null, className), "data-qa": qa, children: [statusIcon, _jsx(Text, { variant: "body-1", children: text }), button ? (_jsx(Button, { onClick: button.onClick, size: "s", view: "outlined", className: b('action'), children: button.content })) : null] }));
|
|
25
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { DOMProps, QAProps } from '@gravity-ui/uikit';
|
|
2
|
+
import './ChatDate.scss';
|
|
3
|
+
export type ChatDateProps = QAProps & DOMProps & {
|
|
4
|
+
/** Date value in string, Date, or number (timestamp) format */
|
|
5
|
+
date: string | Date | number;
|
|
6
|
+
/** Show time along with date */
|
|
7
|
+
showTime?: boolean;
|
|
8
|
+
/** Custom format string (dayjs format) */
|
|
9
|
+
format?: string;
|
|
10
|
+
/** Display relative dates (today, yesterday, two days ago, etc.) */
|
|
11
|
+
relative?: boolean;
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* ChatDate component displays formatted dates with optional time
|
|
15
|
+
*
|
|
16
|
+
* @param props - Component props
|
|
17
|
+
* @returns React component
|
|
18
|
+
*/
|
|
19
|
+
export declare function ChatDate(props: ChatDateProps): string | import("react/jsx-runtime").JSX.Element;
|