@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,39 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ContextIndicatorProps } from '../../atoms/ContextIndicator';
|
|
3
|
+
import './PromptInputHeader.scss';
|
|
4
|
+
/**
|
|
5
|
+
* Context item configuration
|
|
6
|
+
*/
|
|
7
|
+
export type ContextItemConfig = {
|
|
8
|
+
/** Unique identifier for the context item */
|
|
9
|
+
id: string;
|
|
10
|
+
/** Content to display in the context item */
|
|
11
|
+
content: ReactNode;
|
|
12
|
+
/** Callback when context item is removed */
|
|
13
|
+
onRemove: () => void;
|
|
14
|
+
};
|
|
15
|
+
/**
|
|
16
|
+
* Props for the PromptInputHeader component
|
|
17
|
+
*/
|
|
18
|
+
export type PromptInputHeaderProps = {
|
|
19
|
+
/** Array of context items to display on the left */
|
|
20
|
+
contextItems?: ContextItemConfig[];
|
|
21
|
+
/** Show context indicator */
|
|
22
|
+
showContextIndicator?: boolean;
|
|
23
|
+
/** Props for the context indicator */
|
|
24
|
+
contextIndicatorProps?: ContextIndicatorProps;
|
|
25
|
+
/** Custom content to replace the default header */
|
|
26
|
+
children?: ReactNode;
|
|
27
|
+
/** Additional CSS class */
|
|
28
|
+
className?: string;
|
|
29
|
+
/** QA/test identifier */
|
|
30
|
+
qa?: string;
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* PromptInputHeader component displays the header section of prompt input
|
|
34
|
+
* with optional context items on the left, context indicator on the right, or custom content
|
|
35
|
+
*
|
|
36
|
+
* @param props - Component props
|
|
37
|
+
* @returns React component
|
|
38
|
+
*/
|
|
39
|
+
export declare function PromptInputHeader(props: PromptInputHeaderProps): import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { block } from '../../../utils/cn';
|
|
3
|
+
import { ContextIndicator } from '../../atoms/ContextIndicator';
|
|
4
|
+
import { ContextItem } from '../../atoms/ContextItem';
|
|
5
|
+
import './PromptInputHeader.scss';
|
|
6
|
+
const b = block('prompt-input-header');
|
|
7
|
+
/**
|
|
8
|
+
* PromptInputHeader component displays the header section of prompt input
|
|
9
|
+
* with optional context items on the left, context indicator on the right, or custom content
|
|
10
|
+
*
|
|
11
|
+
* @param props - Component props
|
|
12
|
+
* @returns React component
|
|
13
|
+
*/
|
|
14
|
+
export function PromptInputHeader(props) {
|
|
15
|
+
const { contextItems = [], showContextIndicator = false, contextIndicatorProps, children, className, qa, } = props;
|
|
16
|
+
// If custom content is provided, render it
|
|
17
|
+
if (children) {
|
|
18
|
+
return (_jsx("div", { className: b(null, className), "data-qa": qa, children: children }));
|
|
19
|
+
}
|
|
20
|
+
// Check if we have anything to display
|
|
21
|
+
const hasContextItems = contextItems.length > 0;
|
|
22
|
+
const hasContextIndicator = showContextIndicator && contextIndicatorProps;
|
|
23
|
+
const shouldRender = hasContextItems || hasContextIndicator;
|
|
24
|
+
if (!shouldRender) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
return (_jsxs("div", { className: b(null, className), "data-qa": qa, children: [hasContextItems && (_jsx("div", { className: b('context-items'), children: contextItems.map((item) => (_jsx(ContextItem, { content: item.content, onClick: item.onRemove, qa: `${qa}-context-item-${item.id}` }, item.id))) })), hasContextIndicator && (_jsx("div", { className: b('context-indicator'), children: _jsx(ContextIndicator, Object.assign({}, contextIndicatorProps)) }))] }));
|
|
28
|
+
}
|
package/dist/src/components/molecules/PromptInputHeader/__stories__/PromptInputHeader.stories.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { PromptInputHeader } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
type Story = StoryObj<typeof PromptInputHeader>;
|
|
6
|
+
export declare const Playground: Story;
|
|
7
|
+
export declare const WithContextItems: Story;
|
|
8
|
+
export declare const WithSingleContextItem: Story;
|
|
9
|
+
export declare const WithManyContextItems: Story;
|
|
10
|
+
export declare const WithContextItemsAndIndicator: Story;
|
|
11
|
+
export declare const WithContextIndicator: Story;
|
|
12
|
+
export declare const WithContextIndicatorNumber: Story;
|
|
13
|
+
export declare const WithCustomContent: Story;
|
package/dist/src/components/molecules/PromptInputHeader/__stories__/PromptInputHeader.stories.js
ADDED
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState } from 'react';
|
|
3
|
+
import { PromptInputHeader } from '..';
|
|
4
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
5
|
+
import { SwapArea } from '../../../../demo/SwapArea';
|
|
6
|
+
import MDXDocs from './Docs.mdx';
|
|
7
|
+
export default {
|
|
8
|
+
title: 'molecules/PromptInputHeader',
|
|
9
|
+
component: PromptInputHeader,
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
page: MDXDocs,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const defaultDecorators = [
|
|
17
|
+
(Story) => (_jsx(ContentWrapper, { width: "450px", children: _jsx(Story, {}) })),
|
|
18
|
+
];
|
|
19
|
+
export const Playground = {
|
|
20
|
+
args: {},
|
|
21
|
+
decorators: defaultDecorators,
|
|
22
|
+
};
|
|
23
|
+
export const WithContextItems = {
|
|
24
|
+
render: (args) => {
|
|
25
|
+
const [items, setItems] = useState([
|
|
26
|
+
{ id: '1', content: 'file.tsx', onRemove: () => { } },
|
|
27
|
+
{ id: '2', content: 'component.tsx', onRemove: () => { } },
|
|
28
|
+
{ id: '3', content: 'utils.ts', onRemove: () => { } },
|
|
29
|
+
]);
|
|
30
|
+
const handleRemove = (id) => {
|
|
31
|
+
setItems(items.filter((item) => item.id !== id));
|
|
32
|
+
};
|
|
33
|
+
return (_jsx(PromptInputHeader, Object.assign({}, args, { contextItems: items.map((item) => (Object.assign(Object.assign({}, item), { onRemove: () => handleRemove(item.id) }))) })));
|
|
34
|
+
},
|
|
35
|
+
decorators: defaultDecorators,
|
|
36
|
+
};
|
|
37
|
+
export const WithSingleContextItem = {
|
|
38
|
+
args: {
|
|
39
|
+
contextItems: [
|
|
40
|
+
{
|
|
41
|
+
id: '1',
|
|
42
|
+
content: 'README.md',
|
|
43
|
+
onRemove: () => {
|
|
44
|
+
// Handle remove
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
},
|
|
49
|
+
decorators: defaultDecorators,
|
|
50
|
+
};
|
|
51
|
+
export const WithManyContextItems = {
|
|
52
|
+
args: {
|
|
53
|
+
contextItems: [
|
|
54
|
+
{ id: '1', content: 'file1.tsx', onRemove: () => { } },
|
|
55
|
+
{ id: '2', content: 'file2.tsx', onRemove: () => { } },
|
|
56
|
+
{ id: '3', content: 'file3.tsx', onRemove: () => { } },
|
|
57
|
+
{ id: '4', content: 'file4.tsx', onRemove: () => { } },
|
|
58
|
+
{ id: '5', content: 'file5.tsx', onRemove: () => { } },
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
decorators: defaultDecorators,
|
|
62
|
+
};
|
|
63
|
+
export const WithContextItemsAndIndicator = {
|
|
64
|
+
args: {
|
|
65
|
+
contextItems: [
|
|
66
|
+
{ id: '1', content: 'file.tsx', onRemove: () => { } },
|
|
67
|
+
{ id: '2', content: 'component.tsx', onRemove: () => { } },
|
|
68
|
+
],
|
|
69
|
+
showContextIndicator: true,
|
|
70
|
+
contextIndicatorProps: {
|
|
71
|
+
type: 'percent',
|
|
72
|
+
usedContext: 75,
|
|
73
|
+
},
|
|
74
|
+
},
|
|
75
|
+
decorators: defaultDecorators,
|
|
76
|
+
};
|
|
77
|
+
export const WithContextIndicator = {
|
|
78
|
+
args: {
|
|
79
|
+
showContextIndicator: true,
|
|
80
|
+
contextIndicatorProps: {
|
|
81
|
+
type: 'percent',
|
|
82
|
+
usedContext: 24,
|
|
83
|
+
},
|
|
84
|
+
},
|
|
85
|
+
decorators: defaultDecorators,
|
|
86
|
+
};
|
|
87
|
+
export const WithContextIndicatorNumber = {
|
|
88
|
+
args: {
|
|
89
|
+
showContextIndicator: true,
|
|
90
|
+
contextIndicatorProps: {
|
|
91
|
+
type: 'number',
|
|
92
|
+
usedContext: 2400,
|
|
93
|
+
maxContext: 10000,
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
decorators: defaultDecorators,
|
|
97
|
+
};
|
|
98
|
+
export const WithCustomContent = {
|
|
99
|
+
args: {
|
|
100
|
+
children: _jsx(SwapArea, {}),
|
|
101
|
+
},
|
|
102
|
+
decorators: defaultDecorators,
|
|
103
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PromptInputHeader, type PromptInputHeaderProps, type ContextItemConfig, } from './PromptInputHeader';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PromptInputHeader, } from './PromptInputHeader';
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import './PromptInputPanel.scss';
|
|
3
|
+
/**
|
|
4
|
+
* Props for the PromptInputPanel component
|
|
5
|
+
*/
|
|
6
|
+
export type PromptInputPanelProps = {
|
|
7
|
+
/** Panel content */
|
|
8
|
+
children?: ReactNode;
|
|
9
|
+
/** Additional CSS class */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** QA/test identifier */
|
|
12
|
+
qa?: string;
|
|
13
|
+
};
|
|
14
|
+
/**
|
|
15
|
+
* PromptInputPanel component displays a panel with custom content
|
|
16
|
+
*
|
|
17
|
+
* @param props - Component props
|
|
18
|
+
* @returns React component
|
|
19
|
+
*/
|
|
20
|
+
export declare function PromptInputPanel(props: PromptInputPanelProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { block } from '../../../utils/cn';
|
|
3
|
+
import './PromptInputPanel.scss';
|
|
4
|
+
const b = block('prompt-input-panel');
|
|
5
|
+
/**
|
|
6
|
+
* PromptInputPanel component displays a panel with custom content
|
|
7
|
+
*
|
|
8
|
+
* @param props - Component props
|
|
9
|
+
* @returns React component
|
|
10
|
+
*/
|
|
11
|
+
export function PromptInputPanel(props) {
|
|
12
|
+
const { children, className, qa } = props;
|
|
13
|
+
return (_jsx("div", { className: b(null, className), "data-qa": qa, children: children }));
|
|
14
|
+
}
|
package/dist/src/components/molecules/PromptInputPanel/__stories__/PromptInputPanel.stories.d.ts
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { PromptInputPanel } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
type Story = StoryObj<typeof PromptInputPanel>;
|
|
6
|
+
export declare const Playground: Story;
|
|
7
|
+
export declare const WithSwapArea: Story;
|
|
8
|
+
export declare const WithContentAndCloseButton: Story;
|
package/dist/src/components/molecules/PromptInputPanel/__stories__/PromptInputPanel.stories.js
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Xmark } from '@gravity-ui/icons';
|
|
3
|
+
import { Button, Icon } from '@gravity-ui/uikit';
|
|
4
|
+
import { PromptInputPanel } from '..';
|
|
5
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
6
|
+
import { SwapArea } from '../../../../demo/SwapArea';
|
|
7
|
+
import { ActionButton } from '../../../atoms/ActionButton';
|
|
8
|
+
import MDXDocs from './Docs.mdx';
|
|
9
|
+
export default {
|
|
10
|
+
title: 'molecules/PromptInputPanel',
|
|
11
|
+
component: PromptInputPanel,
|
|
12
|
+
parameters: {
|
|
13
|
+
docs: {
|
|
14
|
+
page: MDXDocs,
|
|
15
|
+
},
|
|
16
|
+
},
|
|
17
|
+
};
|
|
18
|
+
const defaultDecorators = [
|
|
19
|
+
(Story) => (_jsx(ContentWrapper, { children: _jsx(Story, {}) })),
|
|
20
|
+
];
|
|
21
|
+
export const Playground = {
|
|
22
|
+
args: {
|
|
23
|
+
children: 'This is the panel content',
|
|
24
|
+
},
|
|
25
|
+
decorators: defaultDecorators,
|
|
26
|
+
};
|
|
27
|
+
export const WithSwapArea = {
|
|
28
|
+
args: {
|
|
29
|
+
children: _jsx(SwapArea, {}),
|
|
30
|
+
},
|
|
31
|
+
decorators: defaultDecorators,
|
|
32
|
+
};
|
|
33
|
+
export const WithContentAndCloseButton = {
|
|
34
|
+
args: {
|
|
35
|
+
children: (_jsxs(_Fragment, { children: [_jsx("div", { style: { flex: 1 }, children: _jsx("span", { children: "Upgrade your plan to Business to unlock all features" }) }), _jsx(Button, { view: "action", size: "m", children: "Upgrade" }), _jsx(ActionButton, { view: "flat", size: "m", onClick: () => { }, children: _jsx(Icon, { data: Xmark, size: 16 }) })] })),
|
|
36
|
+
},
|
|
37
|
+
decorators: defaultDecorators,
|
|
38
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { PromptInputPanel } from './PromptInputPanel';
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { ButtonButtonProps } from '@gravity-ui/uikit';
|
|
2
|
+
import './Suggestions.scss';
|
|
3
|
+
export type SuggestionsItem = {
|
|
4
|
+
/** Optional unique identifier for the item */
|
|
5
|
+
id?: string;
|
|
6
|
+
/** Title text to display on the button */
|
|
7
|
+
title: string;
|
|
8
|
+
/** Button view */
|
|
9
|
+
view?: ButtonButtonProps['view'];
|
|
10
|
+
/** Icon position: 'left' for ChevronLeft, 'right' for ChevronRight */
|
|
11
|
+
icon?: 'left' | 'right';
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
* Props for the Suggestions component
|
|
15
|
+
*/
|
|
16
|
+
export type SuggestionsProps = {
|
|
17
|
+
/** Array of suggestion items to display */
|
|
18
|
+
items: SuggestionsItem[];
|
|
19
|
+
/** Callback function called when a suggestion is clicked */
|
|
20
|
+
onClick: (content: string, id?: string) => void | Promise<void>;
|
|
21
|
+
/** Layout orientation: 'grid' for horizontal, 'list' for vertical */
|
|
22
|
+
layout?: 'grid' | 'list';
|
|
23
|
+
/** Text alignment inside buttons: 'left', 'center', or 'right' */
|
|
24
|
+
textAlign?: 'left' | 'center' | 'right';
|
|
25
|
+
/** Additional CSS class */
|
|
26
|
+
className?: string;
|
|
27
|
+
/** QA/test identifier */
|
|
28
|
+
qa?: string;
|
|
29
|
+
};
|
|
30
|
+
/**
|
|
31
|
+
* Suggestions component displays a group of clickable suggestion buttons
|
|
32
|
+
* arranged in either horizontal (grid) or vertical (list) layout
|
|
33
|
+
*
|
|
34
|
+
* @param props - Component props
|
|
35
|
+
* @returns React component
|
|
36
|
+
*/
|
|
37
|
+
export declare function Suggestions(props: SuggestionsProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChevronLeft, ChevronRight } from '@gravity-ui/icons';
|
|
3
|
+
import { Icon, Text } from '@gravity-ui/uikit';
|
|
4
|
+
import { block } from '../../../utils/cn';
|
|
5
|
+
import { ActionButton } from '../../atoms';
|
|
6
|
+
import './Suggestions.scss';
|
|
7
|
+
const b = block('suggestions');
|
|
8
|
+
/**
|
|
9
|
+
* Suggestions component displays a group of clickable suggestion buttons
|
|
10
|
+
* arranged in either horizontal (grid) or vertical (list) layout
|
|
11
|
+
*
|
|
12
|
+
* @param props - Component props
|
|
13
|
+
* @returns React component
|
|
14
|
+
*/
|
|
15
|
+
export function Suggestions(props) {
|
|
16
|
+
const { items, onClick, layout = 'list', textAlign = 'left', className, qa } = props;
|
|
17
|
+
const handleClick = (item) => {
|
|
18
|
+
onClick(item.title, item.id);
|
|
19
|
+
};
|
|
20
|
+
const renderButton = (item, index) => {
|
|
21
|
+
return (_jsx(ActionButton, { tooltipTitle: item.title, size: "m", view: item.view || 'outlined', onClick: () => handleClick(item), className: b('button', { layout }), width: "auto", children: _jsxs("div", { className: b('button-content', {
|
|
22
|
+
layout,
|
|
23
|
+
'text-align': item.icon ? undefined : textAlign,
|
|
24
|
+
}), children: [item.icon === 'left' && (_jsx("div", { className: b('button-icon'), children: _jsx(Icon, { data: ChevronLeft, size: 16 }) })), _jsx(Text, { as: "div", className: b('button-text'), children: item.title }), item.icon === 'right' && (_jsx("div", { className: b('button-icon'), children: _jsx(Icon, { data: ChevronRight, size: 16 }) }))] }) }, item.id || index));
|
|
25
|
+
};
|
|
26
|
+
return (_jsx("div", { className: b({ layout }, className), "data-qa": qa, children: items.map((item, index) => renderButton(item, index)) }));
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react-webpack5';
|
|
2
|
+
import { SuggestionsProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<SuggestionsProps>;
|
|
6
|
+
export declare const ListLayout: StoryFn<SuggestionsProps>;
|
|
7
|
+
export declare const ListLayoutWithContainer: StoryFn<SuggestionsProps>;
|
|
8
|
+
export declare const GridLayout: StoryFn<SuggestionsProps>;
|
|
9
|
+
export declare const GridLayoutWithContainer: StoryFn<SuggestionsProps>;
|
|
10
|
+
export declare const WithoutIds: StoryFn<SuggestionsProps>;
|
|
11
|
+
export declare const SingleItem: StoryFn<SuggestionsProps>;
|
|
12
|
+
export declare const TextAlignLeft: StoryFn<SuggestionsProps>;
|
|
13
|
+
export declare const TextAlignCenter: StoryFn<SuggestionsProps>;
|
|
14
|
+
export declare const TextAlignRight: StoryFn<SuggestionsProps>;
|
|
15
|
+
export declare const WithLeftIcon: StoryFn<SuggestionsProps>;
|
|
16
|
+
export declare const WithRightIcon: StoryFn<SuggestionsProps>;
|
|
17
|
+
export declare const WithMixedIcons: StoryFn<SuggestionsProps>;
|
|
18
|
+
export declare const IconsWithContainer: StoryFn<SuggestionsProps>;
|
|
19
|
+
export declare const WithIconsInGridLayout: StoryFn<SuggestionsProps>;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Suggestions } from '..';
|
|
3
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
4
|
+
import MDXDocs from './Docs.mdx';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'molecules/Suggestions',
|
|
7
|
+
component: Suggestions,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
page: MDXDocs,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
items: {
|
|
15
|
+
control: 'object',
|
|
16
|
+
description: 'Array of suggestion items to display',
|
|
17
|
+
},
|
|
18
|
+
onClick: {
|
|
19
|
+
action: 'clicked',
|
|
20
|
+
description: 'Callback function called when a suggestion is clicked',
|
|
21
|
+
},
|
|
22
|
+
layout: {
|
|
23
|
+
control: 'select',
|
|
24
|
+
options: ['grid', 'list'],
|
|
25
|
+
description: 'Layout orientation: grid for horizontal, list for vertical',
|
|
26
|
+
},
|
|
27
|
+
textAlign: {
|
|
28
|
+
control: 'select',
|
|
29
|
+
options: ['left', 'center', 'right'],
|
|
30
|
+
description: 'Text alignment inside buttons',
|
|
31
|
+
},
|
|
32
|
+
className: {
|
|
33
|
+
control: 'text',
|
|
34
|
+
description: 'Additional CSS class',
|
|
35
|
+
},
|
|
36
|
+
qa: {
|
|
37
|
+
control: 'text',
|
|
38
|
+
description: 'QA/test identifier',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args)) }));
|
|
43
|
+
Playground.args = {
|
|
44
|
+
items: [
|
|
45
|
+
{ id: '1', title: 'First suggestion' },
|
|
46
|
+
{ id: '2', title: 'Second suggestion' },
|
|
47
|
+
{ id: '3', title: 'Third suggestion' },
|
|
48
|
+
],
|
|
49
|
+
onClick: () => {
|
|
50
|
+
// onClick handler
|
|
51
|
+
},
|
|
52
|
+
layout: 'list',
|
|
53
|
+
};
|
|
54
|
+
export const ListLayout = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
|
|
55
|
+
{ id: '1', title: 'Example suggestion' },
|
|
56
|
+
{ id: '2', title: 'Another one suggestion' },
|
|
57
|
+
{ id: '3', title: 'Looooooong suggestion for testing' },
|
|
58
|
+
], layout: "list", onClick: () => {
|
|
59
|
+
// onClick handler
|
|
60
|
+
} })) }));
|
|
61
|
+
export const ListLayoutWithContainer = (args) => (_jsx(ContentWrapper, { width: "200px", children: _jsx(Suggestions, Object.assign({}, args, { items: [
|
|
62
|
+
{ id: '1', title: 'Example suggestion' },
|
|
63
|
+
{ id: '2', title: 'Another one suggestion' },
|
|
64
|
+
{ id: '3', title: 'Looooooong suggestion for testing' },
|
|
65
|
+
], layout: "list", onClick: () => {
|
|
66
|
+
// onClick handler
|
|
67
|
+
} })) }));
|
|
68
|
+
export const GridLayout = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
|
|
69
|
+
{ id: '1', title: 'Option 1' },
|
|
70
|
+
{ id: '2', title: 'Option 2' },
|
|
71
|
+
{ id: '3', title: 'Option 3' },
|
|
72
|
+
{ id: '4', title: 'Option 4' },
|
|
73
|
+
], layout: "grid", onClick: () => {
|
|
74
|
+
// onClick handler
|
|
75
|
+
} })) }));
|
|
76
|
+
export const GridLayoutWithContainer = (args) => (_jsx(ContentWrapper, { width: "300px", children: _jsx(Suggestions, Object.assign({}, args, { items: [
|
|
77
|
+
{ id: '1', title: 'Option 1' },
|
|
78
|
+
{ id: '2', title: 'Option 2' },
|
|
79
|
+
{ id: '3', title: 'Option 3' },
|
|
80
|
+
{ id: '4', title: 'Option 4' },
|
|
81
|
+
], layout: "grid", onClick: () => {
|
|
82
|
+
// onClick handler
|
|
83
|
+
} })) }));
|
|
84
|
+
export const WithoutIds = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [{ title: 'First item' }, { title: 'Second item' }, { title: 'Third item' }], onClick: () => {
|
|
85
|
+
// onClick handler
|
|
86
|
+
} })) }));
|
|
87
|
+
export const SingleItem = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [{ id: '1', title: 'Only one suggestion' }], onClick: () => {
|
|
88
|
+
// onClick handler
|
|
89
|
+
} })) }));
|
|
90
|
+
export const TextAlignLeft = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
|
|
91
|
+
{ id: '1', title: 'Left aligned text' },
|
|
92
|
+
{ id: '2', title: 'Another left aligned suggestion' },
|
|
93
|
+
], textAlign: "left", onClick: () => {
|
|
94
|
+
// onClick handler
|
|
95
|
+
} })) }));
|
|
96
|
+
export const TextAlignCenter = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
|
|
97
|
+
{ id: '1', title: 'Center aligned text' },
|
|
98
|
+
{ id: '2', title: 'Another centered suggestion' },
|
|
99
|
+
], textAlign: "center", onClick: () => {
|
|
100
|
+
// onClick handler
|
|
101
|
+
} })) }));
|
|
102
|
+
export const TextAlignRight = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
|
|
103
|
+
{ id: '1', title: 'Right aligned text' },
|
|
104
|
+
{ id: '2', title: 'Another right aligned suggestion' },
|
|
105
|
+
], textAlign: "right", onClick: () => {
|
|
106
|
+
// onClick handler
|
|
107
|
+
} })) }));
|
|
108
|
+
export const WithLeftIcon = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
|
|
109
|
+
{ id: '1', title: 'Previous page', icon: 'left' },
|
|
110
|
+
{ id: '2', title: 'Go back', icon: 'left' },
|
|
111
|
+
{ id: '3', title: 'Return to start', icon: 'left' },
|
|
112
|
+
], onClick: () => {
|
|
113
|
+
// onClick handler
|
|
114
|
+
} })) }));
|
|
115
|
+
export const WithRightIcon = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
|
|
116
|
+
{ id: '1', title: 'Next page', icon: 'right' },
|
|
117
|
+
{ id: '2', title: 'Continue', icon: 'right' },
|
|
118
|
+
{ id: '3', title: 'Go forward', icon: 'right' },
|
|
119
|
+
], onClick: () => {
|
|
120
|
+
// onClick handler
|
|
121
|
+
} })) }));
|
|
122
|
+
export const WithMixedIcons = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
|
|
123
|
+
{ id: '1', title: 'Previous', icon: 'left' },
|
|
124
|
+
{ id: '2', title: 'No action' },
|
|
125
|
+
{ id: '3', title: 'Next', icon: 'right' },
|
|
126
|
+
], layout: "grid", onClick: () => {
|
|
127
|
+
// onClick handler
|
|
128
|
+
} })) }));
|
|
129
|
+
export const IconsWithContainer = (args) => (_jsx(ContentWrapper, { width: "200px", children: _jsx(Suggestions, Object.assign({}, args, { items: [
|
|
130
|
+
{ id: '1', title: 'Example suggestion', icon: 'right' },
|
|
131
|
+
{ id: '2', title: 'Another one suggestion', icon: 'right' },
|
|
132
|
+
{ id: '3', title: 'Looooooong suggestion for testing', icon: 'right' },
|
|
133
|
+
], layout: "list", onClick: () => {
|
|
134
|
+
// onClick handler
|
|
135
|
+
} })) }));
|
|
136
|
+
export const WithIconsInGridLayout = (args) => (_jsx(ContentWrapper, { children: _jsx(Suggestions, Object.assign({}, args, { items: [
|
|
137
|
+
{ id: '1', title: 'Back', icon: 'left' },
|
|
138
|
+
{ id: '2', title: 'Home' },
|
|
139
|
+
{ id: '3', title: 'Settings' },
|
|
140
|
+
{ id: '4', title: 'Forward', icon: 'right' },
|
|
141
|
+
], layout: "grid", onClick: () => {
|
|
142
|
+
// onClick handler
|
|
143
|
+
} })) }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Suggestions';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Suggestions';
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { DOMProps, QAProps } from '@gravity-ui/uikit';
|
|
3
|
+
import './Tabs.scss';
|
|
4
|
+
export type TabsProps = QAProps & DOMProps & {
|
|
5
|
+
items: {
|
|
6
|
+
id: string;
|
|
7
|
+
title: string;
|
|
8
|
+
icon?: React.ReactNode;
|
|
9
|
+
}[];
|
|
10
|
+
activeId?: string;
|
|
11
|
+
onSelectItem?: (id: string) => void;
|
|
12
|
+
onDeleteItem?: (id: string) => Promise<void>;
|
|
13
|
+
allowDelete?: boolean;
|
|
14
|
+
};
|
|
15
|
+
export declare const Tabs: (props: TabsProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useCallback } from 'react';
|
|
4
|
+
import { Label } from '@gravity-ui/uikit';
|
|
5
|
+
import { block } from '../../../utils/cn';
|
|
6
|
+
import './Tabs.scss';
|
|
7
|
+
const b = block('tabs');
|
|
8
|
+
export const Tabs = (props) => {
|
|
9
|
+
const { items, activeId, onSelectItem, onDeleteItem, allowDelete = false, className, style, qa, } = props;
|
|
10
|
+
const handleTabClick = useCallback((id) => {
|
|
11
|
+
if (onSelectItem) {
|
|
12
|
+
onSelectItem(id);
|
|
13
|
+
}
|
|
14
|
+
}, [onSelectItem]);
|
|
15
|
+
const handleDeleteClick = useCallback((id) => {
|
|
16
|
+
if (onDeleteItem) {
|
|
17
|
+
onDeleteItem(id);
|
|
18
|
+
}
|
|
19
|
+
}, [onDeleteItem]);
|
|
20
|
+
return (_jsx("div", { className: b(null, className), style: style, "data-qa": qa, children: items.map((item) => {
|
|
21
|
+
const isActive = item.id === activeId;
|
|
22
|
+
return (_jsx(Label, { size: "s", theme: isActive ? 'info' : 'clear', interactive: true, onClick: () => handleTabClick(item.id), type: allowDelete ? 'close' : 'default', onCloseClick: allowDelete ? () => handleDeleteClick(item.id) : undefined, icon: item.icon, className: b('tab', { active: isActive }), "data-qa": `${qa}-tab-${item.id}`, children: item.title }, item.id));
|
|
23
|
+
}) }));
|
|
24
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { type TabsProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<TabsProps>;
|
|
6
|
+
export declare const Basic: StoryObj<TabsProps>;
|
|
7
|
+
export declare const WithIcons: StoryObj<TabsProps>;
|
|
8
|
+
export declare const WithStyle: StoryObj<TabsProps>;
|
|
9
|
+
export declare const MaxWidth: StoryObj<TabsProps>;
|