@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
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const i18n: ((key: "default-error-text" | "retry-button", params?: import("@gravity-ui/i18n").Params) => string) & {
|
|
2
|
+
Translation: import("react").ComponentType<{
|
|
3
|
+
children: (props: {
|
|
4
|
+
t: (key: "default-error-text" | "retry-button", params?: import("@gravity-ui/i18n").Params) => string;
|
|
5
|
+
}) => React.ReactNode;
|
|
6
|
+
}>;
|
|
7
|
+
useTranslation: () => {
|
|
8
|
+
t: (key: "default-error-text" | "retry-button", params?: import("@gravity-ui/i18n").Params) => string;
|
|
9
|
+
};
|
|
10
|
+
keysetData: {
|
|
11
|
+
"g-aikit-MessageList": Record<"default-error-text" | "retry-button", import("@gravity-ui/i18n").KeyData>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MessageList';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MessageList';
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { ChatStatus, TSubmitData } from '../../../types';
|
|
2
|
+
import { PromptInputBodyConfig, PromptInputFooterConfig, PromptInputHeaderConfig, PromptInputPanelConfig, PromptInputSuggestionsConfig } from './types';
|
|
3
|
+
import './PromptInput.scss';
|
|
4
|
+
/**
|
|
5
|
+
* Props for the PromptInput component
|
|
6
|
+
*/
|
|
7
|
+
export type PromptInputProps = {
|
|
8
|
+
/** View variant: 'full' with all features, 'simple' with minimal UI */
|
|
9
|
+
view?: 'full' | 'simple';
|
|
10
|
+
/** Callback when message is sent */
|
|
11
|
+
onSend: (data: TSubmitData) => Promise<void>;
|
|
12
|
+
/** Callback when sending is cancelled */
|
|
13
|
+
onCancel?: () => Promise<void>;
|
|
14
|
+
/** Disabled state */
|
|
15
|
+
disabled?: boolean;
|
|
16
|
+
/** Chat status to determine input behavior */
|
|
17
|
+
status?: ChatStatus;
|
|
18
|
+
/** Maximum length of input */
|
|
19
|
+
maxLength?: number;
|
|
20
|
+
/** Header-related props */
|
|
21
|
+
headerProps?: PromptInputHeaderConfig;
|
|
22
|
+
/** Body/textarea-related props */
|
|
23
|
+
bodyProps?: PromptInputBodyConfig;
|
|
24
|
+
/** Footer-related props */
|
|
25
|
+
footerProps?: PromptInputFooterConfig;
|
|
26
|
+
/** Suggestions-related props */
|
|
27
|
+
suggestionsProps?: PromptInputSuggestionsConfig;
|
|
28
|
+
/** Top panel configuration */
|
|
29
|
+
topPanel?: PromptInputPanelConfig;
|
|
30
|
+
/** Bottom panel configuration */
|
|
31
|
+
bottomPanel?: PromptInputPanelConfig;
|
|
32
|
+
/** Additional CSS class */
|
|
33
|
+
className?: string;
|
|
34
|
+
/** QA/test identifier */
|
|
35
|
+
qa?: string;
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* PromptInput component - a flexible input component for chat interfaces
|
|
39
|
+
* with support for simple and full views, attachments, suggestions, and expandable panels
|
|
40
|
+
*
|
|
41
|
+
* @param props - Component props
|
|
42
|
+
* @returns React component
|
|
43
|
+
*/
|
|
44
|
+
export declare function PromptInput(props: PromptInputProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { PromptInputFull } from './PromptInputFull';
|
|
3
|
+
import { PromptInputSimple } from './PromptInputSimple';
|
|
4
|
+
import { PromptInputWithPanels } from './PromptInputWithPanels';
|
|
5
|
+
import { PromptInputWithSuggestions } from './PromptInputWithSuggestions';
|
|
6
|
+
import { usePromptInput } from './usePromptInput';
|
|
7
|
+
import './PromptInput.scss';
|
|
8
|
+
/**
|
|
9
|
+
* PromptInput component - a flexible input component for chat interfaces
|
|
10
|
+
* with support for simple and full views, attachments, suggestions, and expandable panels
|
|
11
|
+
*
|
|
12
|
+
* @param props - Component props
|
|
13
|
+
* @returns React component
|
|
14
|
+
*/
|
|
15
|
+
export function PromptInput(props) {
|
|
16
|
+
const { view = 'simple', onSend, onCancel, disabled = false, status = 'ready', maxLength, headerProps, bodyProps, footerProps, suggestionsProps, topPanel, bottomPanel, className, qa, } = props;
|
|
17
|
+
const hookState = usePromptInput({
|
|
18
|
+
onSend,
|
|
19
|
+
onCancel,
|
|
20
|
+
disabled,
|
|
21
|
+
status,
|
|
22
|
+
maxLength,
|
|
23
|
+
});
|
|
24
|
+
// Handle suggestion click with custom handler or default to input change
|
|
25
|
+
const handleSuggestionClick = (suggestion) => {
|
|
26
|
+
if (suggestionsProps === null || suggestionsProps === void 0 ? void 0 : suggestionsProps.onSuggestionClick) {
|
|
27
|
+
suggestionsProps.onSuggestionClick(suggestion);
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
hookState.handleChange(suggestion);
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const isFullView = view === 'full';
|
|
34
|
+
// Prepare suggestions props with wrapped handler
|
|
35
|
+
const wrappedSuggestionsProps = suggestionsProps
|
|
36
|
+
? Object.assign(Object.assign({}, suggestionsProps), { onSuggestionClick: handleSuggestionClick }) : undefined;
|
|
37
|
+
return (_jsx(PromptInputWithSuggestions, { suggestionsProps: wrappedSuggestionsProps, children: _jsx(PromptInputWithPanels, { topPanel: topPanel, bottomPanel: bottomPanel, children: isFullView ? (_jsx(PromptInputFull, { hookState: hookState, headerProps: headerProps, bodyProps: bodyProps, footerProps: footerProps, className: className, qa: qa })) : (_jsx(PromptInputSimple, { hookState: hookState, bodyProps: bodyProps, footerProps: footerProps, className: className, qa: qa })) }) }));
|
|
38
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PromptInputBodyConfig, PromptInputFooterConfig, PromptInputHeaderConfig } from './types';
|
|
2
|
+
import { UsePromptInputReturn } from './usePromptInput';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the PromptInputFull component
|
|
5
|
+
*/
|
|
6
|
+
export type PromptInputFullProps = {
|
|
7
|
+
/** Hook return value with state and handlers */
|
|
8
|
+
hookState: UsePromptInputReturn;
|
|
9
|
+
/** Header-related props */
|
|
10
|
+
headerProps?: PromptInputHeaderConfig;
|
|
11
|
+
/** Body/textarea-related props */
|
|
12
|
+
bodyProps?: PromptInputBodyConfig;
|
|
13
|
+
/** Footer-related props */
|
|
14
|
+
footerProps?: PromptInputFooterConfig;
|
|
15
|
+
/** Additional CSS class */
|
|
16
|
+
className?: string;
|
|
17
|
+
/** QA/test identifier */
|
|
18
|
+
qa?: string;
|
|
19
|
+
};
|
|
20
|
+
/**
|
|
21
|
+
* PromptInputFull component - full view with header, body, and footer
|
|
22
|
+
*
|
|
23
|
+
* @param props - Component props
|
|
24
|
+
* @returns React component
|
|
25
|
+
*/
|
|
26
|
+
export declare function PromptInputFull(props: PromptInputFullProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { block } from '../../../utils/cn';
|
|
3
|
+
import { PromptInputBody } from '../../molecules/PromptInputBody';
|
|
4
|
+
import { PromptInputFooter } from '../../molecules/PromptInputFooter';
|
|
5
|
+
import { PromptInputHeader } from '../../molecules/PromptInputHeader';
|
|
6
|
+
const b = block('prompt-input');
|
|
7
|
+
/**
|
|
8
|
+
* PromptInputFull component - full view with header, body, and footer
|
|
9
|
+
*
|
|
10
|
+
* @param props - Component props
|
|
11
|
+
* @returns React component
|
|
12
|
+
*/
|
|
13
|
+
export function PromptInputFull(props) {
|
|
14
|
+
const { hookState, headerProps = {}, bodyProps = {}, footerProps = {}, className, qa } = props;
|
|
15
|
+
const { topContent, contextItems = [], showContextIndicator = false, contextIndicatorProps, } = headerProps;
|
|
16
|
+
const { placeholder = 'Plan, code, build and test anything', minRows = 1, maxRows = 15, autoFocus = false, } = bodyProps;
|
|
17
|
+
const { bottomContent, showSettings = false, onSettingsClick, showAttachment = false, onAttachmentClick, showMicrophone = false, onMicrophoneClick, } = footerProps;
|
|
18
|
+
const { value, submitButtonState, handleChange, handleKeyDown, handleSubmit } = hookState;
|
|
19
|
+
const shouldShowHeader = topContent || contextItems.length > 0 || showContextIndicator;
|
|
20
|
+
const shouldShowFooter = true;
|
|
21
|
+
return (_jsxs("div", { className: b({ view: 'full' }, className), "data-qa": qa, children: [shouldShowHeader && (_jsx(PromptInputHeader, { contextItems: contextItems, showContextIndicator: showContextIndicator, contextIndicatorProps: contextIndicatorProps, children: topContent })), _jsx(PromptInputBody, { value: value, placeholder: placeholder, minRows: minRows, maxRows: maxRows, autoFocus: autoFocus, onChange: handleChange, onKeyDown: handleKeyDown }), shouldShowFooter && (_jsx(PromptInputFooter, { submitButton: {
|
|
22
|
+
onClick: handleSubmit,
|
|
23
|
+
state: submitButtonState,
|
|
24
|
+
}, showSettings: showSettings, onSettingsClick: onSettingsClick, showAttachment: showAttachment, onAttachmentClick: onAttachmentClick, showMicrophone: showMicrophone, onMicrophoneClick: onMicrophoneClick, children: bottomContent }))] }));
|
|
25
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { PromptInputBodyConfig, PromptInputFooterConfig } from './types';
|
|
2
|
+
import { UsePromptInputReturn } from './usePromptInput';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the PromptInputSimple component
|
|
5
|
+
*/
|
|
6
|
+
export type PromptInputSimpleProps = {
|
|
7
|
+
/** Hook return value with state and handlers */
|
|
8
|
+
hookState: UsePromptInputReturn;
|
|
9
|
+
/** Body/textarea-related props */
|
|
10
|
+
bodyProps?: PromptInputBodyConfig;
|
|
11
|
+
/** Footer-related props */
|
|
12
|
+
footerProps?: PromptInputFooterConfig;
|
|
13
|
+
/** Additional CSS class */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** QA/test identifier */
|
|
16
|
+
qa?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* PromptInputSimple component - simple view with just body and footer
|
|
20
|
+
*
|
|
21
|
+
* @param props - Component props
|
|
22
|
+
* @returns React component
|
|
23
|
+
*/
|
|
24
|
+
export declare function PromptInputSimple(props: PromptInputSimpleProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { block } from '../../../utils/cn';
|
|
3
|
+
import { PromptInputBody } from '../../molecules/PromptInputBody';
|
|
4
|
+
import { PromptInputFooter } from '../../molecules/PromptInputFooter';
|
|
5
|
+
const b = block('prompt-input');
|
|
6
|
+
/**
|
|
7
|
+
* PromptInputSimple component - simple view with just body and footer
|
|
8
|
+
*
|
|
9
|
+
* @param props - Component props
|
|
10
|
+
* @returns React component
|
|
11
|
+
*/
|
|
12
|
+
export function PromptInputSimple(props) {
|
|
13
|
+
const { hookState, bodyProps = {}, footerProps = {}, className, qa } = props;
|
|
14
|
+
const { placeholder = 'Plan, code, build and test anything', minRows = 1, maxRows = 15, autoFocus = false, } = bodyProps;
|
|
15
|
+
const { bottomContent, showAttachment = false, onAttachmentClick, showMicrophone = false, onMicrophoneClick, } = footerProps;
|
|
16
|
+
const { value, submitButtonState, handleChange, handleKeyDown, handleSubmit } = hookState;
|
|
17
|
+
return (_jsx("div", { className: b({ view: 'simple' }, className), "data-qa": qa, children: _jsxs("div", { className: b('content'), children: [_jsx(PromptInputBody, { value: value, placeholder: placeholder, minRows: minRows, maxRows: maxRows, autoFocus: autoFocus, onChange: handleChange, onKeyDown: handleKeyDown }), _jsx(PromptInputFooter, { submitButton: {
|
|
18
|
+
onClick: handleSubmit,
|
|
19
|
+
state: submitButtonState,
|
|
20
|
+
}, showAttachment: showAttachment, onAttachmentClick: onAttachmentClick, showMicrophone: showMicrophone, onMicrophoneClick: onMicrophoneClick, buttonSize: "l", children: bottomContent })] }) }));
|
|
21
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { PromptInputPanelConfig } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the PromptInputWithPanels component
|
|
5
|
+
*/
|
|
6
|
+
export type PromptInputWithPanelsProps = {
|
|
7
|
+
/** Child component (PromptInput view) */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** Top panel configuration */
|
|
10
|
+
topPanel?: PromptInputPanelConfig;
|
|
11
|
+
/** Bottom panel configuration */
|
|
12
|
+
bottomPanel?: PromptInputPanelConfig;
|
|
13
|
+
/** Additional CSS class */
|
|
14
|
+
className?: string;
|
|
15
|
+
/** QA/test identifier */
|
|
16
|
+
qa?: string;
|
|
17
|
+
};
|
|
18
|
+
/**
|
|
19
|
+
* PromptInputWithPanels component - wrapper that shows expandable panels around the prompt input
|
|
20
|
+
*
|
|
21
|
+
* @param props - Component props
|
|
22
|
+
* @returns React component
|
|
23
|
+
*/
|
|
24
|
+
export declare function PromptInputWithPanels(props: PromptInputWithPanelsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { block } from '../../../utils/cn';
|
|
3
|
+
import { PromptInputPanel } from '../../molecules/PromptInputPanel';
|
|
4
|
+
import { useDelayedUnmount } from './useDelayedUnmount';
|
|
5
|
+
const b = block('prompt-input');
|
|
6
|
+
/**
|
|
7
|
+
* PromptInputWithPanels component - wrapper that shows expandable panels around the prompt input
|
|
8
|
+
*
|
|
9
|
+
* @param props - Component props
|
|
10
|
+
* @returns React component
|
|
11
|
+
*/
|
|
12
|
+
export function PromptInputWithPanels(props) {
|
|
13
|
+
var _a, _b;
|
|
14
|
+
const { children, topPanel, bottomPanel, className, qa } = props;
|
|
15
|
+
// Use hook to delay unmounting for animation
|
|
16
|
+
const shouldRenderTopPanel = useDelayedUnmount((_a = topPanel === null || topPanel === void 0 ? void 0 : topPanel.isOpen) !== null && _a !== void 0 ? _a : false, 300);
|
|
17
|
+
const shouldRenderBottomPanel = useDelayedUnmount((_b = bottomPanel === null || bottomPanel === void 0 ? void 0 : bottomPanel.isOpen) !== null && _b !== void 0 ? _b : false, 300);
|
|
18
|
+
return (_jsxs("div", { className: b('panel-wrapper', className), "data-qa": qa, children: [topPanel && shouldRenderTopPanel && (_jsx("div", { className: b('panel', { position: 'top', open: topPanel.isOpen }), children: _jsx(PromptInputPanel, { children: topPanel.children }) })), children, bottomPanel && shouldRenderBottomPanel && (_jsx("div", { className: b('panel', { position: 'bottom', open: bottomPanel.isOpen }), children: _jsx(PromptInputPanel, { children: bottomPanel.children }) }))] }));
|
|
19
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { PromptInputSuggestionsConfig } from './types';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the PromptInputWithSuggestions component
|
|
5
|
+
*/
|
|
6
|
+
export type PromptInputWithSuggestionsProps = {
|
|
7
|
+
/** Child component (PromptInput) */
|
|
8
|
+
children: ReactNode;
|
|
9
|
+
/** Suggestions-related props */
|
|
10
|
+
suggestionsProps?: PromptInputSuggestionsConfig;
|
|
11
|
+
/** Additional CSS class */
|
|
12
|
+
className?: string;
|
|
13
|
+
/** QA/test identifier */
|
|
14
|
+
qa?: string;
|
|
15
|
+
};
|
|
16
|
+
/**
|
|
17
|
+
* PromptInputWithSuggestions component - wrapper that shows suggestions above the prompt input
|
|
18
|
+
*
|
|
19
|
+
* @param props - Component props
|
|
20
|
+
* @returns React component
|
|
21
|
+
*/
|
|
22
|
+
export declare function PromptInputWithSuggestions(props: PromptInputWithSuggestionsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { block } from '../../../utils/cn';
|
|
3
|
+
import { Suggestions } from '../../molecules/Suggestions';
|
|
4
|
+
const b = block('prompt-input');
|
|
5
|
+
/**
|
|
6
|
+
* PromptInputWithSuggestions component - wrapper that shows suggestions above the prompt input
|
|
7
|
+
*
|
|
8
|
+
* @param props - Component props
|
|
9
|
+
* @returns React component
|
|
10
|
+
*/
|
|
11
|
+
export function PromptInputWithSuggestions(props) {
|
|
12
|
+
const { children, suggestionsProps = {}, className, qa } = props;
|
|
13
|
+
const { showSuggestions = false, suggestions, onSuggestionClick, suggestionsLayout, suggestionsTextAlign = 'center', } = suggestionsProps;
|
|
14
|
+
const hasSuggestions = showSuggestions && suggestions && suggestions.length > 0;
|
|
15
|
+
return (_jsxs("div", { className: b('suggestions-wrapper', className), "data-qa": qa, children: [hasSuggestions && (_jsx("div", { className: b('suggestions'), children: _jsx(Suggestions, { items: suggestions, onClick: onSuggestionClick || (() => { }), layout: suggestionsLayout, textAlign: suggestionsTextAlign }) })), children] }));
|
|
16
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { PromptInput } from '../PromptInput';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
type Story = StoryObj<typeof PromptInput>;
|
|
6
|
+
export declare const Playground: Story;
|
|
7
|
+
export declare const FullView: Story;
|
|
8
|
+
export declare const WithSuggestions: Story;
|
|
9
|
+
export declare const WithContextIndicator: Story;
|
|
10
|
+
export declare const WithCustomTopContent: Story;
|
|
11
|
+
export declare const WithCustomBottomContent: Story;
|
|
12
|
+
export declare const WithTopPanel: Story;
|
|
13
|
+
export declare const WithBottomPanel: Story;
|
|
14
|
+
export declare const WithBothPanels: Story;
|
|
15
|
+
export declare const WithPanelToggle: Story;
|
|
16
|
+
export declare const Disabled: Story;
|
|
17
|
+
export declare const Streaming: Story;
|
|
18
|
+
export declare const ComplexExample: Story;
|
|
@@ -0,0 +1,278 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { Xmark } from '@gravity-ui/icons';
|
|
4
|
+
import { Icon } from '@gravity-ui/uikit';
|
|
5
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
6
|
+
import { SwapArea } from '../../../../demo/SwapArea';
|
|
7
|
+
import { ActionButton } from '../../../atoms/ActionButton';
|
|
8
|
+
import { PromptInput } from '../PromptInput';
|
|
9
|
+
import MDXDocs from './Docs.mdx';
|
|
10
|
+
export default {
|
|
11
|
+
title: 'organisms/PromptInput',
|
|
12
|
+
component: PromptInput,
|
|
13
|
+
parameters: {
|
|
14
|
+
docs: {
|
|
15
|
+
page: MDXDocs,
|
|
16
|
+
},
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
const defaultDecorators = [
|
|
20
|
+
(Story) => (_jsx(ContentWrapper, { width: "450px", children: _jsx(Story, {}) })),
|
|
21
|
+
];
|
|
22
|
+
const handleSend = async (data) => {
|
|
23
|
+
// eslint-disable-next-line no-console
|
|
24
|
+
console.log('Sending:', data);
|
|
25
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
26
|
+
};
|
|
27
|
+
export const Playground = {
|
|
28
|
+
args: {
|
|
29
|
+
view: 'simple',
|
|
30
|
+
onSend: handleSend,
|
|
31
|
+
bodyProps: {
|
|
32
|
+
placeholder: 'Plan, code, build and test anything',
|
|
33
|
+
},
|
|
34
|
+
footerProps: {
|
|
35
|
+
showAttachment: true,
|
|
36
|
+
showMicrophone: true,
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
decorators: defaultDecorators,
|
|
40
|
+
};
|
|
41
|
+
export const FullView = {
|
|
42
|
+
args: {
|
|
43
|
+
view: 'full',
|
|
44
|
+
onSend: handleSend,
|
|
45
|
+
bodyProps: {
|
|
46
|
+
placeholder: 'Plan, code, build and test anything',
|
|
47
|
+
},
|
|
48
|
+
headerProps: {
|
|
49
|
+
showContextIndicator: true,
|
|
50
|
+
contextIndicatorProps: {
|
|
51
|
+
type: 'percent',
|
|
52
|
+
usedContext: 24,
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
footerProps: {
|
|
56
|
+
showSettings: true,
|
|
57
|
+
showAttachment: true,
|
|
58
|
+
showMicrophone: true,
|
|
59
|
+
// eslint-disable-next-line no-console
|
|
60
|
+
onSettingsClick: () => console.log('Settings clicked'),
|
|
61
|
+
// eslint-disable-next-line no-console
|
|
62
|
+
onAttachmentClick: () => console.log('Attachment clicked'),
|
|
63
|
+
// eslint-disable-next-line no-console
|
|
64
|
+
onMicrophoneClick: () => console.log('Microphone clicked'),
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
decorators: defaultDecorators,
|
|
68
|
+
};
|
|
69
|
+
export const WithSuggestions = {
|
|
70
|
+
args: {
|
|
71
|
+
view: 'simple',
|
|
72
|
+
onSend: handleSend,
|
|
73
|
+
bodyProps: {
|
|
74
|
+
placeholder: 'Plan, code, build and test anything',
|
|
75
|
+
},
|
|
76
|
+
suggestionsProps: {
|
|
77
|
+
showSuggestions: true,
|
|
78
|
+
suggestions: [
|
|
79
|
+
{ title: 'Write a Python function', view: 'action' },
|
|
80
|
+
{ title: 'Explain this code' },
|
|
81
|
+
],
|
|
82
|
+
// eslint-disable-next-line no-console
|
|
83
|
+
onSuggestionClick: (suggestion) => console.log('Suggestion clicked:', suggestion),
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
decorators: defaultDecorators,
|
|
87
|
+
};
|
|
88
|
+
export const WithContextIndicator = {
|
|
89
|
+
args: {
|
|
90
|
+
view: 'full',
|
|
91
|
+
onSend: handleSend,
|
|
92
|
+
bodyProps: {
|
|
93
|
+
placeholder: 'Plan, code, build and test anything',
|
|
94
|
+
},
|
|
95
|
+
headerProps: {
|
|
96
|
+
showContextIndicator: true,
|
|
97
|
+
contextIndicatorProps: {
|
|
98
|
+
type: 'percent',
|
|
99
|
+
usedContext: 24,
|
|
100
|
+
},
|
|
101
|
+
},
|
|
102
|
+
},
|
|
103
|
+
decorators: defaultDecorators,
|
|
104
|
+
};
|
|
105
|
+
export const WithCustomTopContent = {
|
|
106
|
+
args: {
|
|
107
|
+
view: 'full',
|
|
108
|
+
onSend: handleSend,
|
|
109
|
+
bodyProps: {
|
|
110
|
+
placeholder: 'Plan, code, build and test anything',
|
|
111
|
+
},
|
|
112
|
+
headerProps: {
|
|
113
|
+
topContent: _jsx(SwapArea, {}),
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
decorators: defaultDecorators,
|
|
117
|
+
};
|
|
118
|
+
export const WithCustomBottomContent = {
|
|
119
|
+
args: {
|
|
120
|
+
view: 'full',
|
|
121
|
+
onSend: handleSend,
|
|
122
|
+
bodyProps: {
|
|
123
|
+
placeholder: 'Plan, code, build and test anything',
|
|
124
|
+
},
|
|
125
|
+
footerProps: {
|
|
126
|
+
bottomContent: _jsx(SwapArea, {}),
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
decorators: defaultDecorators,
|
|
130
|
+
};
|
|
131
|
+
export const WithTopPanel = {
|
|
132
|
+
args: {
|
|
133
|
+
view: 'simple',
|
|
134
|
+
onSend: handleSend,
|
|
135
|
+
bodyProps: {
|
|
136
|
+
placeholder: 'Plan, code, build and test anything',
|
|
137
|
+
},
|
|
138
|
+
topPanel: {
|
|
139
|
+
isOpen: true,
|
|
140
|
+
children: _jsx(SwapArea, {}),
|
|
141
|
+
},
|
|
142
|
+
},
|
|
143
|
+
decorators: defaultDecorators,
|
|
144
|
+
};
|
|
145
|
+
export const WithBottomPanel = {
|
|
146
|
+
args: {
|
|
147
|
+
view: 'simple',
|
|
148
|
+
onSend: handleSend,
|
|
149
|
+
bodyProps: {
|
|
150
|
+
placeholder: 'Plan, code, build and test anything',
|
|
151
|
+
},
|
|
152
|
+
bottomPanel: {
|
|
153
|
+
isOpen: true,
|
|
154
|
+
children: _jsx(SwapArea, {}),
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
decorators: defaultDecorators,
|
|
158
|
+
};
|
|
159
|
+
export const WithBothPanels = {
|
|
160
|
+
args: {
|
|
161
|
+
view: 'full',
|
|
162
|
+
onSend: handleSend,
|
|
163
|
+
bodyProps: {
|
|
164
|
+
placeholder: 'Plan, code, build and test anything',
|
|
165
|
+
},
|
|
166
|
+
headerProps: {
|
|
167
|
+
showContextIndicator: true,
|
|
168
|
+
contextIndicatorProps: {
|
|
169
|
+
type: 'percent',
|
|
170
|
+
usedContext: 24,
|
|
171
|
+
},
|
|
172
|
+
},
|
|
173
|
+
topPanel: {
|
|
174
|
+
isOpen: true,
|
|
175
|
+
children: _jsx(SwapArea, {}),
|
|
176
|
+
},
|
|
177
|
+
bottomPanel: {
|
|
178
|
+
isOpen: true,
|
|
179
|
+
children: _jsx(SwapArea, {}),
|
|
180
|
+
},
|
|
181
|
+
},
|
|
182
|
+
decorators: defaultDecorators,
|
|
183
|
+
};
|
|
184
|
+
const PanelExample = ({ onClose }) => {
|
|
185
|
+
return (_jsxs(_Fragment, { children: [_jsx(SwapArea, {}), _jsx(ActionButton, { view: "flat", size: "m", onClick: onClose, children: _jsx(Icon, { data: Xmark, size: 16 }) })] }));
|
|
186
|
+
};
|
|
187
|
+
export const WithPanelToggle = {
|
|
188
|
+
render: () => {
|
|
189
|
+
const [isTopPanelOpen, setIsTopPanelOpen] = useState(false);
|
|
190
|
+
const [isBottomPanelOpen, setIsBottomPanelOpen] = useState(false);
|
|
191
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '16px' }, children: [_jsxs("div", { style: { display: 'flex', gap: '8px' }, children: [_jsx(ActionButton, { view: "action", size: "m", onClick: () => setIsTopPanelOpen((prev) => !prev), children: "Toggle Top Panel" }), _jsx(ActionButton, { view: "action", size: "m", onClick: () => setIsBottomPanelOpen((prev) => !prev), children: "Toggle Bottom Panel" })] }), _jsx(PromptInput, { view: "full", onSend: handleSend, bodyProps: {
|
|
192
|
+
placeholder: 'Plan, code, build and test anything',
|
|
193
|
+
}, topPanel: {
|
|
194
|
+
isOpen: isTopPanelOpen,
|
|
195
|
+
children: _jsx(PanelExample, { onClose: () => setIsTopPanelOpen(false) }),
|
|
196
|
+
}, bottomPanel: {
|
|
197
|
+
isOpen: isBottomPanelOpen,
|
|
198
|
+
children: _jsx(PanelExample, { onClose: () => setIsBottomPanelOpen(false) }),
|
|
199
|
+
} })] }));
|
|
200
|
+
},
|
|
201
|
+
decorators: defaultDecorators,
|
|
202
|
+
};
|
|
203
|
+
export const Disabled = {
|
|
204
|
+
args: {
|
|
205
|
+
view: 'simple',
|
|
206
|
+
onSend: handleSend,
|
|
207
|
+
disabled: true,
|
|
208
|
+
bodyProps: {
|
|
209
|
+
placeholder: 'Plan, code, build and test anything',
|
|
210
|
+
},
|
|
211
|
+
},
|
|
212
|
+
decorators: defaultDecorators,
|
|
213
|
+
};
|
|
214
|
+
export const Streaming = {
|
|
215
|
+
render: (args) => {
|
|
216
|
+
const [status, setStatus] = useState('ready');
|
|
217
|
+
const handleSendWithStreaming = async (data) => {
|
|
218
|
+
// eslint-disable-next-line no-console
|
|
219
|
+
console.log('Sending:', data);
|
|
220
|
+
setStatus('streaming');
|
|
221
|
+
await new Promise((resolve) => setTimeout(resolve, 3000));
|
|
222
|
+
setStatus('ready');
|
|
223
|
+
};
|
|
224
|
+
const handleCancel = async () => {
|
|
225
|
+
// eslint-disable-next-line no-console
|
|
226
|
+
console.log('Cancelling');
|
|
227
|
+
setStatus('ready');
|
|
228
|
+
};
|
|
229
|
+
return (_jsx(PromptInput, Object.assign({}, args, { view: "full", onSend: handleSendWithStreaming, onCancel: handleCancel, status: status, bodyProps: {
|
|
230
|
+
placeholder: 'Plan, code, build and test anything',
|
|
231
|
+
}, footerProps: {
|
|
232
|
+
showSettings: true,
|
|
233
|
+
showAttachment: true,
|
|
234
|
+
showMicrophone: true,
|
|
235
|
+
} })));
|
|
236
|
+
},
|
|
237
|
+
decorators: defaultDecorators,
|
|
238
|
+
};
|
|
239
|
+
export const ComplexExample = {
|
|
240
|
+
render: (args) => {
|
|
241
|
+
const [status, setStatus] = useState('ready');
|
|
242
|
+
const handleSendComplex = async (data) => {
|
|
243
|
+
// eslint-disable-next-line no-console
|
|
244
|
+
console.log('Sending:', data);
|
|
245
|
+
setStatus('streaming');
|
|
246
|
+
await new Promise((resolve) => setTimeout(resolve, 2000));
|
|
247
|
+
setStatus('ready');
|
|
248
|
+
};
|
|
249
|
+
const handleCancel = async () => {
|
|
250
|
+
// eslint-disable-next-line no-console
|
|
251
|
+
console.log('Cancelling');
|
|
252
|
+
setStatus('ready');
|
|
253
|
+
};
|
|
254
|
+
return (_jsx(PromptInput, Object.assign({}, args, { view: "full", onSend: handleSendComplex, onCancel: handleCancel, status: status, bodyProps: {
|
|
255
|
+
placeholder: 'Plan, code, build and test anything',
|
|
256
|
+
}, headerProps: {
|
|
257
|
+
showContextIndicator: true,
|
|
258
|
+
contextIndicatorProps: {
|
|
259
|
+
type: 'percent',
|
|
260
|
+
usedContext: 24,
|
|
261
|
+
},
|
|
262
|
+
}, footerProps: {
|
|
263
|
+
showSettings: true,
|
|
264
|
+
showAttachment: true,
|
|
265
|
+
showMicrophone: true,
|
|
266
|
+
// eslint-disable-next-line no-console
|
|
267
|
+
onSettingsClick: () => console.log('Settings'),
|
|
268
|
+
// eslint-disable-next-line no-console
|
|
269
|
+
onAttachmentClick: () => console.log('Attachment'),
|
|
270
|
+
// eslint-disable-next-line no-console
|
|
271
|
+
onMicrophoneClick: () => console.log('Microphone'),
|
|
272
|
+
}, suggestionsProps: {
|
|
273
|
+
showSuggestions: status !== 'streaming',
|
|
274
|
+
suggestions: [{ title: 'Yes', view: 'action' }, { title: 'No' }],
|
|
275
|
+
} })));
|
|
276
|
+
},
|
|
277
|
+
decorators: defaultDecorators,
|
|
278
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { PromptInput, type PromptInputProps } from './PromptInput';
|
|
2
|
+
export { PromptInputFull, type PromptInputFullProps } from './PromptInputFull';
|
|
3
|
+
export { PromptInputSimple, type PromptInputSimpleProps } from './PromptInputSimple';
|
|
4
|
+
export { PromptInputWithPanels, type PromptInputWithPanelsProps } from './PromptInputWithPanels';
|
|
5
|
+
export { PromptInputWithSuggestions, type PromptInputWithSuggestionsProps, } from './PromptInputWithSuggestions';
|
|
6
|
+
export { type PromptInputBodyConfig, type PromptInputFooterConfig, type PromptInputHeaderConfig, type PromptInputPanelConfig, type PromptInputSuggestionsConfig, } from './types';
|
|
7
|
+
export { usePromptInput, type UsePromptInputProps, type UsePromptInputReturn, } from './usePromptInput';
|
|
8
|
+
export { useDelayedUnmount } from './useDelayedUnmount';
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { PromptInput } from './PromptInput';
|
|
2
|
+
export { PromptInputFull } from './PromptInputFull';
|
|
3
|
+
export { PromptInputSimple } from './PromptInputSimple';
|
|
4
|
+
export { PromptInputWithPanels } from './PromptInputWithPanels';
|
|
5
|
+
export { PromptInputWithSuggestions, } from './PromptInputWithSuggestions';
|
|
6
|
+
export { usePromptInput, } from './usePromptInput';
|
|
7
|
+
export { useDelayedUnmount } from './useDelayedUnmount';
|