@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,47 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Loader } from '..';
|
|
3
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
4
|
+
import { Showcase } from '../../../../demo/Showcase';
|
|
5
|
+
import { ShowcaseItem } from '../../../../demo/ShowcaseItem';
|
|
6
|
+
import MDXDocs from './Docs.mdx';
|
|
7
|
+
export default {
|
|
8
|
+
title: 'atoms/Loader',
|
|
9
|
+
component: Loader,
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
page: MDXDocs,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
argTypes: {
|
|
16
|
+
view: {
|
|
17
|
+
control: 'radio',
|
|
18
|
+
options: ['streaming', 'loading'],
|
|
19
|
+
description: 'View',
|
|
20
|
+
},
|
|
21
|
+
size: {
|
|
22
|
+
control: 'radio',
|
|
23
|
+
options: ['xs', 's', 'm'],
|
|
24
|
+
description: 'Size of element',
|
|
25
|
+
},
|
|
26
|
+
className: {
|
|
27
|
+
control: 'text',
|
|
28
|
+
description: 'Additional CSS class',
|
|
29
|
+
},
|
|
30
|
+
qa: {
|
|
31
|
+
control: 'text',
|
|
32
|
+
description: 'QA/test identifier',
|
|
33
|
+
},
|
|
34
|
+
},
|
|
35
|
+
};
|
|
36
|
+
const defaultDecorators = [
|
|
37
|
+
(Story) => (_jsx(ContentWrapper, { children: _jsx(Showcase, { children: _jsx(Story, {}) }) })),
|
|
38
|
+
];
|
|
39
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(Loader, Object.assign({}, args)) }));
|
|
40
|
+
Playground.args = { view: 'streaming', size: 's' };
|
|
41
|
+
export const Loading = (args) => (_jsx(ContentWrapper, { children: _jsx(Loader, Object.assign({}, args, { view: "loading" })) }));
|
|
42
|
+
export const Streaming = (args) => (_jsx(ContentWrapper, { children: _jsx(Loader, Object.assign({}, args, { view: "streaming" })) }));
|
|
43
|
+
export const Size = {
|
|
44
|
+
render: (args) => (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "Size xs", children: _jsx(Loader, Object.assign({}, args, { size: "xs" })) }), _jsx(ShowcaseItem, { title: "Size s", children: _jsx(Loader, Object.assign({}, args, { size: "s" })) }), _jsx(ShowcaseItem, { title: "Size m", children: _jsx(Loader, Object.assign({}, args, { size: "m" })) })] })),
|
|
45
|
+
decorators: defaultDecorators,
|
|
46
|
+
args: { view: 'streaming' },
|
|
47
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Loader';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Loader';
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import '@diplodoc/transform/dist/js/yfm';
|
|
2
|
+
import { OptionsType } from '@diplodoc/transform/lib/typings';
|
|
3
|
+
import './MarkdownRenderer.scss';
|
|
4
|
+
export interface MarkdownRendererProps {
|
|
5
|
+
content: string;
|
|
6
|
+
className?: string;
|
|
7
|
+
qa?: string;
|
|
8
|
+
transformOptions?: OptionsType;
|
|
9
|
+
}
|
|
10
|
+
export declare function MarkdownRenderer({ content, className, qa, transformOptions, }: MarkdownRendererProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo } from 'react';
|
|
3
|
+
import transform from '@diplodoc/transform';
|
|
4
|
+
import '@diplodoc/transform/dist/js/yfm';
|
|
5
|
+
import { block } from '../../../utils/cn';
|
|
6
|
+
import './MarkdownRenderer.scss';
|
|
7
|
+
const b = block('markdown-renderer');
|
|
8
|
+
export function MarkdownRenderer({ content, className, qa, transformOptions, }) {
|
|
9
|
+
const html = useMemo(() => {
|
|
10
|
+
if (typeof content !== 'string') {
|
|
11
|
+
return '';
|
|
12
|
+
}
|
|
13
|
+
try {
|
|
14
|
+
const result = transform(content, transformOptions);
|
|
15
|
+
return result.result.html;
|
|
16
|
+
}
|
|
17
|
+
catch (error) {
|
|
18
|
+
// eslint-disable-next-line no-console
|
|
19
|
+
console.error('Error transforming markdown:', error);
|
|
20
|
+
return '';
|
|
21
|
+
}
|
|
22
|
+
}, [content, transformOptions]);
|
|
23
|
+
return (_jsx("div", { className: b(null, [className, 'yfm']), "data-qa": qa, dangerouslySetInnerHTML: { __html: html } }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react-webpack5';
|
|
2
|
+
import { MarkdownRendererProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<MarkdownRendererProps>;
|
|
6
|
+
export declare const WithTransformOptions: StoryFn<MarkdownRendererProps>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MarkdownRenderer } from '..';
|
|
3
|
+
import MDXDocs from './Docs.mdx';
|
|
4
|
+
export default {
|
|
5
|
+
title: 'atoms/MarkdownRenderer',
|
|
6
|
+
component: MarkdownRenderer,
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
page: MDXDocs,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
argTypes: {
|
|
13
|
+
content: {
|
|
14
|
+
control: 'text',
|
|
15
|
+
description: 'YFM markdown content to render',
|
|
16
|
+
},
|
|
17
|
+
className: {
|
|
18
|
+
control: 'text',
|
|
19
|
+
description: 'Additional CSS class',
|
|
20
|
+
},
|
|
21
|
+
qa: {
|
|
22
|
+
control: 'text',
|
|
23
|
+
description: 'QA/test identifier',
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
export const Playground = (args) => _jsx(MarkdownRenderer, Object.assign({}, args));
|
|
28
|
+
Playground.args = {
|
|
29
|
+
content: '# Hello World\n\nThis is **bold** text and this is *italic* text.',
|
|
30
|
+
};
|
|
31
|
+
export const WithTransformOptions = () => {
|
|
32
|
+
const customPlugin = ((md) => {
|
|
33
|
+
const defaultRender = md.renderer.rules.strong_open ||
|
|
34
|
+
function (tokens, idx, options, _env, self) {
|
|
35
|
+
return self.renderToken(tokens, idx, options);
|
|
36
|
+
};
|
|
37
|
+
// eslint-disable-next-line no-param-reassign
|
|
38
|
+
md.renderer.rules.strong_open = function (tokens, idx, options, _env, self) {
|
|
39
|
+
const token = tokens[idx];
|
|
40
|
+
token.attrSet('style', 'color: #ff6b6b; background-color: #fff5f5; padding: 2px 4px; border-radius: 3px;');
|
|
41
|
+
return defaultRender(tokens, idx, options, _env, self);
|
|
42
|
+
};
|
|
43
|
+
});
|
|
44
|
+
const transformOptions = {
|
|
45
|
+
plugins: [customPlugin],
|
|
46
|
+
};
|
|
47
|
+
const content = `# Custom Plugin Example\n\nThis is **bold text** with custom styling applied via plugin.`;
|
|
48
|
+
return _jsx(MarkdownRenderer, { content: content, transformOptions: transformOptions });
|
|
49
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MarkdownRenderer';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './MarkdownRenderer';
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react-webpack5';
|
|
2
|
+
import { type MessageBalloonProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<MessageBalloonProps>;
|
|
6
|
+
export declare const User: StoryFn<MessageBalloonProps>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { MessageBalloon } from '..';
|
|
3
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
4
|
+
import MDXDocs from './Docs.mdx';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'atoms/MessageBalloon',
|
|
7
|
+
component: MessageBalloon,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
page: MDXDocs,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
children: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'Content of message',
|
|
17
|
+
},
|
|
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
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(MessageBalloon, Object.assign({}, args)) }));
|
|
29
|
+
Playground.args = {
|
|
30
|
+
children: 'User question',
|
|
31
|
+
};
|
|
32
|
+
export const User = (args) => (_jsx(ContentWrapper, { children: _jsx(MessageBalloon, Object.assign({}, args, { children: "User question" })) }));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { block } from '../../../utils/cn';
|
|
3
|
+
import './MessageBalloon.scss';
|
|
4
|
+
const b = block('message-balloon');
|
|
5
|
+
export const MessageBalloon = (props) => {
|
|
6
|
+
const { className, qa, children } = props;
|
|
7
|
+
return (_jsx("div", { className: b(null, className), "data-qa": qa, children: children }));
|
|
8
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Shimmer } from '..';
|
|
3
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
4
|
+
import MDXDocs from './Docs.mdx';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'atoms/Shimmer',
|
|
7
|
+
component: Shimmer,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
page: MDXDocs,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
children: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'Content to apply shimmer to',
|
|
17
|
+
},
|
|
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
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(Shimmer, Object.assign({}, args, { children: _jsx("span", { children: "Awaiting confirmation" }) })) }));
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { block } from '../../../utils/cn';
|
|
3
|
+
import './Shimmer.scss';
|
|
4
|
+
const b = block('shimmer');
|
|
5
|
+
export const Shimmer = (props) => {
|
|
6
|
+
const { className, qa, children } = props;
|
|
7
|
+
return (_jsx("div", { className: b('container', className), "data-qa": qa, children: children }));
|
|
8
|
+
};
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ButtonButtonProps } from '@gravity-ui/uikit';
|
|
2
|
+
import './SubmitButton.scss';
|
|
3
|
+
export type SubmitButtonState = 'enabled' | 'disabled' | 'loading' | 'cancelable';
|
|
4
|
+
export interface SubmitButtonProps {
|
|
5
|
+
/**
|
|
6
|
+
* Click handler
|
|
7
|
+
*/
|
|
8
|
+
onClick: () => Promise<void>;
|
|
9
|
+
/**
|
|
10
|
+
* Button state
|
|
11
|
+
*/
|
|
12
|
+
state: SubmitButtonState;
|
|
13
|
+
/**
|
|
14
|
+
* Additional CSS class
|
|
15
|
+
*/
|
|
16
|
+
className?: string;
|
|
17
|
+
/**
|
|
18
|
+
* Button size
|
|
19
|
+
*/
|
|
20
|
+
size?: ButtonButtonProps['size'];
|
|
21
|
+
/**
|
|
22
|
+
* QA/test identifier
|
|
23
|
+
*/
|
|
24
|
+
qa?: string;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Submit button component with state management through props
|
|
28
|
+
*
|
|
29
|
+
* States:
|
|
30
|
+
* - disabled: disabled button state
|
|
31
|
+
* - enabled: enabled button state
|
|
32
|
+
* - loading: loading state
|
|
33
|
+
* - cancelable: cancellation state (during loading)
|
|
34
|
+
*
|
|
35
|
+
* @returns Submit button component
|
|
36
|
+
*/
|
|
37
|
+
export declare function SubmitButton({ onClick, state, className, size, qa }: SubmitButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback } from 'react';
|
|
3
|
+
import { ArrowUp, Stop } from '@gravity-ui/icons';
|
|
4
|
+
import { Icon, Spin } from '@gravity-ui/uikit';
|
|
5
|
+
import { block } from '../../../utils/cn';
|
|
6
|
+
import { ActionButton } from '../ActionButton';
|
|
7
|
+
import { i18n } from './i18n';
|
|
8
|
+
import './SubmitButton.scss';
|
|
9
|
+
const b = block('submit-button');
|
|
10
|
+
/**
|
|
11
|
+
* Submit button component with state management through props
|
|
12
|
+
*
|
|
13
|
+
* States:
|
|
14
|
+
* - disabled: disabled button state
|
|
15
|
+
* - enabled: enabled button state
|
|
16
|
+
* - loading: loading state
|
|
17
|
+
* - cancelable: cancellation state (during loading)
|
|
18
|
+
*
|
|
19
|
+
* @returns Submit button component
|
|
20
|
+
*/
|
|
21
|
+
export function SubmitButton({ onClick, state, className, size = 'm', qa }) {
|
|
22
|
+
const isCancelable = state === 'cancelable';
|
|
23
|
+
const isLoading = state === 'loading';
|
|
24
|
+
const isDisabled = state === 'disabled';
|
|
25
|
+
const iconData = isCancelable ? Stop : ArrowUp;
|
|
26
|
+
const handleClick = useCallback(async () => {
|
|
27
|
+
if (['enabled', 'cancelable'].includes(state)) {
|
|
28
|
+
return onClick();
|
|
29
|
+
}
|
|
30
|
+
return Promise.resolve();
|
|
31
|
+
}, [state, onClick]);
|
|
32
|
+
return (_jsx(ActionButton, { view: "action", size: size, color: "brand", disabled: isDisabled, onClick: handleClick, className: b({ size, loading: isLoading, cancelable: isCancelable }, className), qa: qa, tooltipTitle: i18n('tooltip-send'), children: isLoading ? (_jsx("div", { className: b('loader'), children: _jsx(Spin, { className: b('spinner'), size: "xs" }) })) : (_jsx(Icon, { size: 16, data: iconData })) }));
|
|
33
|
+
}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { SubmitButtonProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<SubmitButtonProps>;
|
|
6
|
+
export declare const Enabled: StoryFn<SubmitButtonProps>;
|
|
7
|
+
export declare const Disabled: StoryFn<SubmitButtonProps>;
|
|
8
|
+
export declare const Loading: StoryFn<SubmitButtonProps>;
|
|
9
|
+
export declare const Cancelable: StoryFn<SubmitButtonProps>;
|
|
10
|
+
export declare const Size: StoryObj<SubmitButtonProps>;
|
|
11
|
+
export declare const States: StoryObj<SubmitButtonProps>;
|
|
12
|
+
export declare const Interactive: StoryFn<SubmitButtonProps>;
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { SubmitButton } from '..';
|
|
4
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
5
|
+
import { Showcase } from '../../../../demo/Showcase';
|
|
6
|
+
import { ShowcaseItem } from '../../../../demo/ShowcaseItem';
|
|
7
|
+
import MDXDocs from './Docs.mdx';
|
|
8
|
+
export default {
|
|
9
|
+
title: 'atoms/SubmitButton',
|
|
10
|
+
component: SubmitButton,
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
page: MDXDocs,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
size: {
|
|
18
|
+
control: 'radio',
|
|
19
|
+
options: ['s', 'm', 'l'],
|
|
20
|
+
description: 'Button size',
|
|
21
|
+
},
|
|
22
|
+
state: {
|
|
23
|
+
control: 'radio',
|
|
24
|
+
options: ['enabled', 'disabled', 'loading', 'cancelable'],
|
|
25
|
+
description: 'Button state',
|
|
26
|
+
},
|
|
27
|
+
className: {
|
|
28
|
+
control: 'text',
|
|
29
|
+
description: 'Additional CSS class',
|
|
30
|
+
},
|
|
31
|
+
qa: {
|
|
32
|
+
control: 'text',
|
|
33
|
+
description: 'QA/test identifier',
|
|
34
|
+
},
|
|
35
|
+
},
|
|
36
|
+
};
|
|
37
|
+
const defaultDecorators = [
|
|
38
|
+
(Story) => (_jsx(ContentWrapper, { children: _jsx(Showcase, { children: _jsx(Story, {}) }) })),
|
|
39
|
+
];
|
|
40
|
+
// Mock function for demonstration
|
|
41
|
+
const mockOnClick = async () => {
|
|
42
|
+
// eslint-disable-next-line no-console
|
|
43
|
+
console.log('Button clicked');
|
|
44
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
45
|
+
// eslint-disable-next-line no-console
|
|
46
|
+
console.log('Action completed');
|
|
47
|
+
};
|
|
48
|
+
export const Playground = (args) => {
|
|
49
|
+
return (_jsx(ContentWrapper, { children: _jsx(SubmitButton, Object.assign({}, args, { onClick: mockOnClick })) }));
|
|
50
|
+
};
|
|
51
|
+
Playground.args = {
|
|
52
|
+
size: 'm',
|
|
53
|
+
state: 'enabled',
|
|
54
|
+
};
|
|
55
|
+
export const Enabled = (args) => {
|
|
56
|
+
return (_jsx(ContentWrapper, { children: _jsx(SubmitButton, Object.assign({}, args, { onClick: mockOnClick, state: "enabled" })) }));
|
|
57
|
+
};
|
|
58
|
+
export const Disabled = (args) => {
|
|
59
|
+
return (_jsx(ContentWrapper, { children: _jsx(SubmitButton, Object.assign({}, args, { onClick: mockOnClick, state: "disabled" })) }));
|
|
60
|
+
};
|
|
61
|
+
export const Loading = (args) => {
|
|
62
|
+
return (_jsx(ContentWrapper, { children: _jsx(SubmitButton, Object.assign({}, args, { onClick: mockOnClick, state: "loading" })) }));
|
|
63
|
+
};
|
|
64
|
+
export const Cancelable = (args) => {
|
|
65
|
+
return (_jsx(ContentWrapper, { children: _jsx(SubmitButton, Object.assign({}, args, { onClick: mockOnClick, state: "cancelable" })) }));
|
|
66
|
+
};
|
|
67
|
+
export const Size = {
|
|
68
|
+
render: (args) => {
|
|
69
|
+
return (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "Size s", children: _jsx(SubmitButton, Object.assign({}, args, { onClick: mockOnClick, size: "s" })) }), _jsx(ShowcaseItem, { title: "Size m", children: _jsx(SubmitButton, Object.assign({}, args, { onClick: mockOnClick, size: "m" })) }), _jsx(ShowcaseItem, { title: "Size l", children: _jsx(SubmitButton, Object.assign({}, args, { onClick: mockOnClick, size: "l" })) })] }));
|
|
70
|
+
},
|
|
71
|
+
decorators: defaultDecorators,
|
|
72
|
+
};
|
|
73
|
+
export const States = {
|
|
74
|
+
render: (args) => {
|
|
75
|
+
return (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "Enabled", children: _jsx(SubmitButton, Object.assign({}, args, { onClick: mockOnClick, state: "enabled" })) }), _jsx(ShowcaseItem, { title: "Disabled", children: _jsx(SubmitButton, Object.assign({}, args, { onClick: mockOnClick, state: "disabled" })) }), _jsx(ShowcaseItem, { title: "Loading", children: _jsx(SubmitButton, Object.assign({}, args, { onClick: mockOnClick, state: "loading" })) }), _jsx(ShowcaseItem, { title: "Cancelable", children: _jsx(SubmitButton, Object.assign({}, args, { onClick: mockOnClick, state: "cancelable" })) })] }));
|
|
76
|
+
},
|
|
77
|
+
decorators: defaultDecorators,
|
|
78
|
+
};
|
|
79
|
+
// Interactive story to demonstrate loading and cancelable states
|
|
80
|
+
export const Interactive = (args) => {
|
|
81
|
+
const [state, setState] = useState('enabled');
|
|
82
|
+
const handleClick = async () => {
|
|
83
|
+
if (state === 'enabled') {
|
|
84
|
+
setState('loading');
|
|
85
|
+
await new Promise((resolve) => setTimeout(resolve, 1000));
|
|
86
|
+
setState('cancelable');
|
|
87
|
+
}
|
|
88
|
+
else if (state === 'cancelable') {
|
|
89
|
+
// eslint-disable-next-line no-console
|
|
90
|
+
console.log('Cancelled');
|
|
91
|
+
setState('enabled');
|
|
92
|
+
}
|
|
93
|
+
};
|
|
94
|
+
return (_jsx(ContentWrapper, { children: _jsx(Showcase, { children: _jsx(ShowcaseItem, { title: "Click the button to see loading and cancelable states", children: _jsx(SubmitButton, Object.assign({}, args, { onClick: handleClick, state: state })) }) }) }));
|
|
95
|
+
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const i18n: ((key: "tooltip-send", params?: import("@gravity-ui/i18n").Params) => string) & {
|
|
2
|
+
Translation: import("react").ComponentType<{
|
|
3
|
+
children: (props: {
|
|
4
|
+
t: (key: "tooltip-send", params?: import("@gravity-ui/i18n").Params) => string;
|
|
5
|
+
}) => React.ReactNode;
|
|
6
|
+
}>;
|
|
7
|
+
useTranslation: () => {
|
|
8
|
+
t: (key: "tooltip-send", params?: import("@gravity-ui/i18n").Params) => string;
|
|
9
|
+
};
|
|
10
|
+
keysetData: {
|
|
11
|
+
"g-aikit-SubmitButton": Record<"tooltip-send", import("@gravity-ui/i18n").KeyData>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SubmitButton';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './SubmitButton';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react-webpack5';
|
|
2
|
+
import { ToolIndicatorProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<ToolIndicatorProps>;
|
|
6
|
+
export declare const Success: StoryFn<ToolIndicatorProps>;
|
|
7
|
+
export declare const Error: StoryFn<ToolIndicatorProps>;
|
|
8
|
+
export declare const Info: StoryFn<ToolIndicatorProps>;
|
|
9
|
+
export declare const Loading: () => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ToolIndicator } from '..';
|
|
3
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
4
|
+
import MDXDocs from './Docs.mdx';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'atoms/ToolIndicator',
|
|
7
|
+
component: ToolIndicator,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
page: MDXDocs,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
status: {
|
|
15
|
+
control: 'radio',
|
|
16
|
+
options: ['success', 'error', 'info', 'loading'],
|
|
17
|
+
description: 'Current status of the tool execution',
|
|
18
|
+
},
|
|
19
|
+
className: {
|
|
20
|
+
control: 'text',
|
|
21
|
+
description: 'Additional CSS class',
|
|
22
|
+
},
|
|
23
|
+
qa: {
|
|
24
|
+
control: 'text',
|
|
25
|
+
description: 'QA/test identifier',
|
|
26
|
+
},
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(ToolIndicator, Object.assign({}, args)) }));
|
|
30
|
+
Playground.args = { status: 'success' };
|
|
31
|
+
export const Success = (args) => (_jsx(ContentWrapper, { children: _jsx(ToolIndicator, Object.assign({}, args, { status: "success" })) }));
|
|
32
|
+
export const Error = (args) => (_jsx(ContentWrapper, { children: _jsx(ToolIndicator, Object.assign({}, args, { status: "error" })) }));
|
|
33
|
+
export const Info = (args) => (_jsx(ContentWrapper, { children: _jsx(ToolIndicator, Object.assign({}, args, { status: "info" })) }));
|
|
34
|
+
export const Loading = () => (_jsx(ContentWrapper, { children: _jsx(ToolIndicator, { status: "loading" }) }));
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import './ToolIndicator.scss';
|
|
2
|
+
export type ToolIndicatorProps = {
|
|
3
|
+
status?: 'success' | 'error' | 'info' | 'loading';
|
|
4
|
+
className?: string;
|
|
5
|
+
qa?: string;
|
|
6
|
+
};
|
|
7
|
+
export declare const ToolIndicator: (props: ToolIndicatorProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { CircleCheck, CircleInfo, CircleXmark } from '@gravity-ui/icons';
|
|
3
|
+
import { Icon } from '@gravity-ui/uikit';
|
|
4
|
+
import { block } from '../../../utils/cn';
|
|
5
|
+
import { Loader } from '../Loader';
|
|
6
|
+
import './ToolIndicator.scss';
|
|
7
|
+
const b = block('tool-indicator');
|
|
8
|
+
export const ToolIndicator = (props) => {
|
|
9
|
+
const { status = 'info', className, qa } = props;
|
|
10
|
+
const commonProps = {
|
|
11
|
+
qa,
|
|
12
|
+
size: 16,
|
|
13
|
+
};
|
|
14
|
+
switch (status) {
|
|
15
|
+
case 'success':
|
|
16
|
+
return _jsx(Icon, Object.assign({}, commonProps, { data: CircleCheck, className: b('success', className) }));
|
|
17
|
+
case 'error':
|
|
18
|
+
return _jsx(Icon, Object.assign({}, commonProps, { data: CircleXmark, className: b('error', className) }));
|
|
19
|
+
case 'info':
|
|
20
|
+
return _jsx(Icon, Object.assign({}, commonProps, { data: CircleInfo, className: b('info', className) }));
|
|
21
|
+
case 'loading':
|
|
22
|
+
return _jsx(Loader, { view: "loading", size: "xs", className: className, qa: qa });
|
|
23
|
+
default:
|
|
24
|
+
return null;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export * from './ActionButton';
|
|
2
|
+
export * from './Alert';
|
|
3
|
+
export * from './ChatDate';
|
|
4
|
+
export * from './ContextIndicator';
|
|
5
|
+
export * from './ContextItem';
|
|
6
|
+
export * from './DiffStat';
|
|
7
|
+
export * from './Disclaimer';
|
|
8
|
+
export * from './InlineCitation';
|
|
9
|
+
export * from './Loader';
|
|
10
|
+
export * from './MarkdownRenderer';
|
|
11
|
+
export * from './MessageBalloon';
|
|
12
|
+
export * from './Shimmer';
|
|
13
|
+
export * from './SubmitButton';
|
|
14
|
+
export * from './ToolIndicator';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
// Export all atoms
|
|
2
|
+
export * from './ActionButton';
|
|
3
|
+
export * from './Alert';
|
|
4
|
+
export * from './ChatDate';
|
|
5
|
+
export * from './ContextIndicator';
|
|
6
|
+
export * from './ContextItem';
|
|
7
|
+
export * from './DiffStat';
|
|
8
|
+
export * from './Disclaimer';
|
|
9
|
+
export * from './InlineCitation';
|
|
10
|
+
export * from './Loader';
|
|
11
|
+
export * from './MarkdownRenderer';
|
|
12
|
+
export * from './MessageBalloon';
|
|
13
|
+
export * from './Shimmer';
|
|
14
|
+
export * from './SubmitButton';
|
|
15
|
+
export * from './ToolIndicator';
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import type { BaseMessageProps } from '../../../../types/messages';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<BaseMessageProps>;
|
|
6
|
+
export declare const Variant: StoryObj<BaseMessageProps>;
|
|
7
|
+
export declare const ShowActionsOnHover: StoryFn<BaseMessageProps>;
|
|
8
|
+
export declare const ShowTimestamp: StoryObj<BaseMessageProps>;
|