@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,24 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Fragment } from 'react';
|
|
3
|
+
import { useDateFormatter } from '../../../hooks';
|
|
4
|
+
import { block } from '../../../utils/cn';
|
|
5
|
+
import { i18n } from './i18n';
|
|
6
|
+
import './ChatDate.scss';
|
|
7
|
+
const b = block('chat-date');
|
|
8
|
+
/**
|
|
9
|
+
* ChatDate component displays formatted dates with optional time
|
|
10
|
+
*
|
|
11
|
+
* @param props - Component props
|
|
12
|
+
* @returns React component
|
|
13
|
+
*/
|
|
14
|
+
export function ChatDate(props) {
|
|
15
|
+
const { date, showTime = false, format, className, qa, relative = false, style } = props;
|
|
16
|
+
const { formattedDate, formattedTime, fullDate, dateObject, isValid, diffDays } = useDateFormatter({
|
|
17
|
+
date,
|
|
18
|
+
format,
|
|
19
|
+
});
|
|
20
|
+
if (!isValid || !dateObject) {
|
|
21
|
+
return i18n('invalid-date');
|
|
22
|
+
}
|
|
23
|
+
return (_jsx("time", { className: b({}, className), dateTime: dateObject.toISOString(), title: fullDate, "data-qa": qa, style: style, children: relative && typeof diffDays === 'number' ? (_jsx("span", { children: i18n('ago', { count: diffDays }) })) : (_jsxs(Fragment, { children: [_jsx("span", { children: formattedDate }), _jsx("span", { children: showTime && formattedTime && ` ${formattedTime}` })] })) }));
|
|
24
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { ChatDateProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<ChatDateProps>;
|
|
6
|
+
export declare const DateString: StoryFn<ChatDateProps>;
|
|
7
|
+
export declare const DateObject: StoryFn<ChatDateProps>;
|
|
8
|
+
export declare const Timestamp: StoryFn<ChatDateProps>;
|
|
9
|
+
export declare const WithTime: StoryFn<ChatDateProps>;
|
|
10
|
+
export declare const CustomFormat: StoryFn<ChatDateProps>;
|
|
11
|
+
export declare const CustomFormatWithTime: StoryFn<ChatDateProps>;
|
|
12
|
+
export declare const WithCustomStyle: StoryFn<ChatDateProps>;
|
|
13
|
+
export declare const DifferentFormats: StoryObj<ChatDateProps>;
|
|
14
|
+
export declare const DifferentDateTypes: StoryObj<ChatDateProps>;
|
|
15
|
+
export declare const RecentDates: StoryObj<ChatDateProps>;
|
|
16
|
+
export declare const InvalidDate: StoryFn<ChatDateProps>;
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ChatDate } from '..';
|
|
3
|
+
import { RELATIVE_DATE_THRESHOLD } from '../../../../constants';
|
|
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/ChatDate',
|
|
10
|
+
component: ChatDate,
|
|
11
|
+
parameters: {
|
|
12
|
+
docs: {
|
|
13
|
+
page: MDXDocs,
|
|
14
|
+
},
|
|
15
|
+
},
|
|
16
|
+
argTypes: {
|
|
17
|
+
date: {
|
|
18
|
+
control: 'text',
|
|
19
|
+
description: 'Date value in string, Date, or number (timestamp) format',
|
|
20
|
+
},
|
|
21
|
+
format: {
|
|
22
|
+
control: 'text',
|
|
23
|
+
description: 'Custom format string (dayjs format)',
|
|
24
|
+
},
|
|
25
|
+
className: {
|
|
26
|
+
control: 'text',
|
|
27
|
+
description: 'Additional CSS class',
|
|
28
|
+
},
|
|
29
|
+
qa: {
|
|
30
|
+
control: 'text',
|
|
31
|
+
description: 'QA/test identifier',
|
|
32
|
+
},
|
|
33
|
+
style: {
|
|
34
|
+
control: 'object',
|
|
35
|
+
description: 'Inline styles for the component',
|
|
36
|
+
},
|
|
37
|
+
locale: {
|
|
38
|
+
control: 'text',
|
|
39
|
+
description: 'Locale for date formatting',
|
|
40
|
+
},
|
|
41
|
+
relative: {
|
|
42
|
+
control: 'boolean',
|
|
43
|
+
description: 'Display relative dates (today, yesterday, two days ago, etc.)',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
const defaultDecorators = [
|
|
48
|
+
(Story) => (_jsx(ContentWrapper, { children: _jsx(Showcase, { children: _jsx(Story, {}) }) })),
|
|
49
|
+
];
|
|
50
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args)) }));
|
|
51
|
+
Playground.args = {
|
|
52
|
+
date: new Date().toISOString(),
|
|
53
|
+
};
|
|
54
|
+
export const DateString = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z" })) }));
|
|
55
|
+
export const DateObject = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: new Date(2024, 0, 15, 10, 30) })) }));
|
|
56
|
+
export const Timestamp = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: 1705312200000 })) }));
|
|
57
|
+
export const WithTime = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z", showTime: true })) }));
|
|
58
|
+
export const CustomFormat = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z", format: "DD/MM/YYYY" })) }));
|
|
59
|
+
export const CustomFormatWithTime = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z", format: "DD/MM/YYYY HH:mm", showTime: true })) }));
|
|
60
|
+
export const WithCustomStyle = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z", style: { color: 'red', fontWeight: 'bold', fontSize: '18px' } })) }));
|
|
61
|
+
export const DifferentFormats = {
|
|
62
|
+
render: (args) => (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "Default", children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z" })) }), _jsx(ShowcaseItem, { title: "DD/MM/YYYY", children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z", format: "DD/MM/YYYY" })) }), _jsx(ShowcaseItem, { title: "MM-DD-YYYY", children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z", format: "MM-DD-YYYY" })) }), _jsx(ShowcaseItem, { title: "YYYY/MM/DD HH-mm", children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z", format: "YYYY/MM/DD HH-mm", showTime: true })) })] })),
|
|
63
|
+
decorators: defaultDecorators,
|
|
64
|
+
};
|
|
65
|
+
export const DifferentDateTypes = {
|
|
66
|
+
render: (args) => (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "ISO String", children: _jsx(ChatDate, Object.assign({}, args, { date: "2024-01-15T10:30:00Z" })) }), _jsx(ShowcaseItem, { title: "Date Object", children: _jsx(ChatDate, Object.assign({}, args, { date: new Date(2024, 0, 15, 10, 30) })) }), _jsx(ShowcaseItem, { title: "Timestamp", children: _jsx(ChatDate, Object.assign({}, args, { date: 1705312200000 })) })] })),
|
|
67
|
+
decorators: defaultDecorators,
|
|
68
|
+
};
|
|
69
|
+
export const RecentDates = {
|
|
70
|
+
render: (args) => {
|
|
71
|
+
const today = new Date('2025-11-11T10:19:59.971Z');
|
|
72
|
+
const getTitle = (daysAgo) => {
|
|
73
|
+
return daysAgo ? `[ + ${daysAgo} ]` : `[ 0 ]`;
|
|
74
|
+
};
|
|
75
|
+
return (_jsx(_Fragment, { children: Array.from({ length: RELATIVE_DATE_THRESHOLD + 1 }, (_, i) => {
|
|
76
|
+
const date = new Date(today);
|
|
77
|
+
date.setDate(date.getDate() - i);
|
|
78
|
+
return (_jsx(ShowcaseItem, { title: getTitle(i), children: _jsx(ChatDate, Object.assign({}, args, { date: date, relative: true })) }, i));
|
|
79
|
+
}) }));
|
|
80
|
+
},
|
|
81
|
+
decorators: defaultDecorators,
|
|
82
|
+
};
|
|
83
|
+
export const InvalidDate = (args) => (_jsx(ContentWrapper, { children: _jsx(ChatDate, Object.assign({}, args, { date: "invalid-date-string" })) }));
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare const i18n: ((key: "ago" | "invalid-date", params?: import("@gravity-ui/i18n").Params) => string) & {
|
|
2
|
+
Translation: import("react").ComponentType<{
|
|
3
|
+
children: (props: {
|
|
4
|
+
t: (key: "ago" | "invalid-date", params?: import("@gravity-ui/i18n").Params) => string;
|
|
5
|
+
}) => React.ReactNode;
|
|
6
|
+
}>;
|
|
7
|
+
useTranslation: () => {
|
|
8
|
+
t: (key: "ago" | "invalid-date", params?: import("@gravity-ui/i18n").Params) => string;
|
|
9
|
+
};
|
|
10
|
+
keysetData: {
|
|
11
|
+
"g-aikit-ChatDate": Record<"ago" | "invalid-date", import("@gravity-ui/i18n").KeyData>;
|
|
12
|
+
};
|
|
13
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChatDate';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './ChatDate';
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react-webpack5';
|
|
2
|
+
import { type ContextIndicatorProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<ContextIndicatorProps>;
|
|
6
|
+
export declare const Empty: StoryFn<ContextIndicatorProps>;
|
|
7
|
+
export declare const Quarter: StoryFn<ContextIndicatorProps>;
|
|
8
|
+
export declare const Half: StoryFn<ContextIndicatorProps>;
|
|
9
|
+
export declare const ThreeQuarters: StoryFn<ContextIndicatorProps>;
|
|
10
|
+
export declare const Full: StoryFn<ContextIndicatorProps>;
|
|
11
|
+
export declare const WithNumber: StoryFn<ContextIndicatorProps>;
|
|
12
|
+
export declare const WithNumberHalf: StoryFn<ContextIndicatorProps>;
|
|
13
|
+
export declare const AllStates: StoryFn<ContextIndicatorProps>;
|
|
14
|
+
export declare const VerticalOrientation: StoryFn<ContextIndicatorProps>;
|
|
15
|
+
export declare const VerticalWithNumber: StoryFn<ContextIndicatorProps>;
|
|
16
|
+
export declare const AllReversedVariants: StoryFn<ContextIndicatorProps>;
|
|
17
|
+
export declare const GrayColors: StoryFn<ContextIndicatorProps>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { ContextIndicator } from '..';
|
|
3
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
4
|
+
import MDXDocs from './Docs.mdx';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'atoms/ContextIndicator',
|
|
7
|
+
component: ContextIndicator,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
page: MDXDocs,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
type: {
|
|
15
|
+
control: 'radio',
|
|
16
|
+
options: ['number', 'percent'],
|
|
17
|
+
description: 'Whether to use direct percentage or calculate from numbers',
|
|
18
|
+
},
|
|
19
|
+
usedContext: {
|
|
20
|
+
control: 'number',
|
|
21
|
+
description: 'Current context usage (percentage or absolute number)',
|
|
22
|
+
},
|
|
23
|
+
maxContext: {
|
|
24
|
+
control: 'number',
|
|
25
|
+
description: 'Maximum context available (only for type="number")',
|
|
26
|
+
if: { arg: 'type', eq: 'number' },
|
|
27
|
+
},
|
|
28
|
+
orientation: {
|
|
29
|
+
control: 'radio',
|
|
30
|
+
options: ['horizontal', 'vertical'],
|
|
31
|
+
description: 'Layout orientation of the indicator',
|
|
32
|
+
},
|
|
33
|
+
reversed: {
|
|
34
|
+
control: 'boolean',
|
|
35
|
+
description: 'Reverses the order of value and progress bar',
|
|
36
|
+
},
|
|
37
|
+
className: {
|
|
38
|
+
control: 'text',
|
|
39
|
+
description: 'Additional CSS class',
|
|
40
|
+
},
|
|
41
|
+
qa: {
|
|
42
|
+
control: 'text',
|
|
43
|
+
description: 'QA/test identifier',
|
|
44
|
+
},
|
|
45
|
+
},
|
|
46
|
+
};
|
|
47
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args)) }));
|
|
48
|
+
Playground.args = {
|
|
49
|
+
type: 'number',
|
|
50
|
+
usedContext: 50,
|
|
51
|
+
maxContext: 100,
|
|
52
|
+
};
|
|
53
|
+
export const Empty = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 0 })) }));
|
|
54
|
+
export const Quarter = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 25 })) }));
|
|
55
|
+
export const Half = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 50 })) }));
|
|
56
|
+
export const ThreeQuarters = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 75 })) }));
|
|
57
|
+
export const Full = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 100 })) }));
|
|
58
|
+
export const WithNumber = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args, { type: "number", usedContext: 50, maxContext: 100 })) }));
|
|
59
|
+
export const WithNumberHalf = (args) => (_jsx(ContentWrapper, { children: _jsx(ContextIndicator, Object.assign({}, args, { type: "number", usedContext: 500, maxContext: 1000 })) }));
|
|
60
|
+
export const AllStates = (args) => (_jsx(ContentWrapper, { children: _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'center' }, children: [_jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 0 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 25 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 50 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 75 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 100 })) })] }) }));
|
|
61
|
+
export const VerticalOrientation = (args) => (_jsx(ContentWrapper, { children: _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'flex-end' }, children: [_jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 0, orientation: "vertical" })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 25, orientation: "vertical" })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 50, orientation: "vertical" })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 75, orientation: "vertical" })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 100, orientation: "vertical" }))] }) }));
|
|
62
|
+
export const VerticalWithNumber = (args) => (_jsx(ContentWrapper, { children: _jsx("div", { style: { display: 'flex', gap: '16px', alignItems: 'flex-end' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "number", usedContext: 500, maxContext: 1000, orientation: "vertical" })) }) }));
|
|
63
|
+
export const AllReversedVariants = (args) => (_jsx(ContentWrapper, { children: _jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '32px' }, children: [_jsxs("div", { children: [_jsx("h4", { style: { marginBottom: '16px' }, children: "Horizontal Reversed" }), _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'center' }, children: [_jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 0, reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 25, reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 50, reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 75, reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 100, reversed: true }))] })] }), _jsxs("div", { children: [_jsx("h4", { style: { marginBottom: '16px' }, children: "Vertical Reversed" }), _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'flex-start' }, children: [_jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 0, orientation: "vertical", reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 25, orientation: "vertical", reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 50, orientation: "vertical", reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 75, orientation: "vertical", reversed: true })), _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 100, orientation: "vertical", reversed: true }))] })] })] }) }));
|
|
64
|
+
export const GrayColors = (args) => (_jsx(ContentWrapper, { children: _jsxs("div", { style: {
|
|
65
|
+
display: 'flex',
|
|
66
|
+
gap: '16px',
|
|
67
|
+
alignItems: 'center',
|
|
68
|
+
// Override all progress colors to gray
|
|
69
|
+
['--g-aikit-ci-color-progress-1']: '#999999',
|
|
70
|
+
['--g-aikit-ci-color-progress-2']: '#999999',
|
|
71
|
+
['--g-aikit-ci-color-progress-3']: '#999999',
|
|
72
|
+
}, children: [_jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 0 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 25 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 50 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 75 })) }), _jsx("div", { style: { textAlign: 'center' }, children: _jsx(ContextIndicator, Object.assign({}, args, { type: "percent", usedContext: 100 })) })] }) }));
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import './ContextIndicator.scss';
|
|
2
|
+
type CommonProps = {
|
|
3
|
+
usedContext: number;
|
|
4
|
+
className?: string;
|
|
5
|
+
qa?: string;
|
|
6
|
+
orientation?: 'horizontal' | 'vertical';
|
|
7
|
+
reversed?: boolean;
|
|
8
|
+
};
|
|
9
|
+
type NumberProps = {
|
|
10
|
+
type: 'number';
|
|
11
|
+
maxContext: number;
|
|
12
|
+
} & CommonProps;
|
|
13
|
+
type PercentProps = {
|
|
14
|
+
type: 'percent';
|
|
15
|
+
usedContext: number;
|
|
16
|
+
} & CommonProps;
|
|
17
|
+
export type ContextIndicatorProps = NumberProps | PercentProps;
|
|
18
|
+
export declare const ContextIndicator: (props: ContextIndicatorProps) => import("react/jsx-runtime").JSX.Element;
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { block } from '../../../utils/cn';
|
|
3
|
+
import { getProgressColor } from './utils';
|
|
4
|
+
import './ContextIndicator.scss';
|
|
5
|
+
const b = block('context-indicator');
|
|
6
|
+
export const ContextIndicator = (props) => {
|
|
7
|
+
const { className, qa, orientation = 'horizontal', reversed = false } = props;
|
|
8
|
+
const percentage = props.type === 'number'
|
|
9
|
+
? Math.round((props.usedContext / props.maxContext) * 100)
|
|
10
|
+
: props.usedContext;
|
|
11
|
+
const clampedPercentage = Math.min(Math.max(percentage, 0), 100);
|
|
12
|
+
return (_jsxs("div", { className: b('container', { orientation, reversed }, className), "data-qa": qa, children: [_jsx("div", { className: b('progress'), style: {
|
|
13
|
+
'--percentage': clampedPercentage,
|
|
14
|
+
'--progress-color': getProgressColor(clampedPercentage),
|
|
15
|
+
}, children: _jsx("div", { className: b('inner') }) }), _jsx("div", { className: b('value'), children: clampedPercentage })] }));
|
|
16
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const getProgressColor: (percentage: number) => "var(--g-aikit-ci-color-progress-1)" | "var(--g-aikit-ci-color-progress-2)" | "var(--g-aikit-ci-color-progress-3)";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react-webpack5';
|
|
2
|
+
import { ContextItem } from '..';
|
|
3
|
+
type ContextItemProps = React.ComponentProps<typeof ContextItem>;
|
|
4
|
+
declare const _default: Meta;
|
|
5
|
+
export default _default;
|
|
6
|
+
export declare const Playground: StoryFn<ContextItemProps>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { ContextItem } from '..';
|
|
3
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
4
|
+
import MDXDocs from './Docs.mdx';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'atoms/ContextItem',
|
|
7
|
+
component: ContextItem,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
page: MDXDocs,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
content: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'Content of label',
|
|
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(ContextItem, Object.assign({}, args)) }));
|
|
29
|
+
Playground.args = {
|
|
30
|
+
content: 'My context',
|
|
31
|
+
onClick: () => { },
|
|
32
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { QAProps } from '@gravity-ui/uikit';
|
|
3
|
+
type ContextItemProps = QAProps & {
|
|
4
|
+
content: React.ReactNode;
|
|
5
|
+
onClick: () => void;
|
|
6
|
+
className?: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const ContextItem: (props: ContextItemProps) => import("react/jsx-runtime").JSX.Element;
|
|
9
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Label } from '@gravity-ui/uikit';
|
|
3
|
+
import { block } from '../../../utils/cn';
|
|
4
|
+
const b = block('context-item');
|
|
5
|
+
export const ContextItem = (props) => {
|
|
6
|
+
const { content, onClick, className, qa } = props;
|
|
7
|
+
return (_jsx(Label, { size: "s", theme: "clear", onCloseClick: onClick, type: "close", className: b(null, className), "data-qa": qa, children: content }));
|
|
8
|
+
};
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { DiffStat } from '..';
|
|
3
|
+
type DiffStatProps = React.ComponentProps<typeof DiffStat>;
|
|
4
|
+
declare const _default: Meta;
|
|
5
|
+
export default _default;
|
|
6
|
+
export declare const Playground: StoryFn<DiffStatProps>;
|
|
7
|
+
export declare const Lengths: StoryObj<typeof DiffStat>;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { DiffStat } 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/DiffStat',
|
|
9
|
+
component: DiffStat,
|
|
10
|
+
parameters: {
|
|
11
|
+
docs: {
|
|
12
|
+
page: MDXDocs,
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
argTypes: {
|
|
16
|
+
added: {
|
|
17
|
+
control: 'number',
|
|
18
|
+
description: 'Number of added lines',
|
|
19
|
+
},
|
|
20
|
+
deleted: {
|
|
21
|
+
control: 'number',
|
|
22
|
+
description: 'Number of deleted lines',
|
|
23
|
+
},
|
|
24
|
+
className: {
|
|
25
|
+
control: 'text',
|
|
26
|
+
description: 'Additional CSS class',
|
|
27
|
+
},
|
|
28
|
+
qa: {
|
|
29
|
+
control: 'text',
|
|
30
|
+
description: 'QA/test identifier',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
};
|
|
34
|
+
const defaultDecorators = [
|
|
35
|
+
(Story) => (_jsx(ContentWrapper, { children: _jsx(Showcase, { children: _jsx(Story, {}) }) })),
|
|
36
|
+
];
|
|
37
|
+
export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(DiffStat, Object.assign({}, args)) }));
|
|
38
|
+
Playground.args = {
|
|
39
|
+
added: 10,
|
|
40
|
+
deleted: 5,
|
|
41
|
+
};
|
|
42
|
+
export const Lengths = {
|
|
43
|
+
render: (args) => (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "Digits", children: _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'center', flexWrap: 'wrap' }, children: [_jsx(DiffStat, Object.assign({}, args, { added: 0, deleted: 0 })), _jsx(DiffStat, Object.assign({}, args, { added: 0, deleted: 1 })), _jsx(DiffStat, Object.assign({}, args, { added: 1, deleted: 0 })), _jsx(DiffStat, Object.assign({}, args, { added: 1, deleted: 1 })), _jsx(DiffStat, Object.assign({}, args, { added: 5, deleted: 3 })), _jsx(DiffStat, Object.assign({}, args, { added: 9, deleted: 9 }))] }) }), _jsx(ShowcaseItem, { title: "Tens", children: _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'center', flexWrap: 'wrap' }, children: [_jsx(DiffStat, Object.assign({}, args, { added: 10, deleted: 0 })), _jsx(DiffStat, Object.assign({}, args, { added: 0, deleted: 10 })), _jsx(DiffStat, Object.assign({}, args, { added: 10, deleted: 10 })), _jsx(DiffStat, Object.assign({}, args, { added: 25, deleted: 15 })), _jsx(DiffStat, Object.assign({}, args, { added: 50, deleted: 30 })), _jsx(DiffStat, Object.assign({}, args, { added: 99, deleted: 99 }))] }) }), _jsx(ShowcaseItem, { title: "Hundreds", children: _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'center', flexWrap: 'wrap' }, children: [_jsx(DiffStat, Object.assign({}, args, { added: 100, deleted: 0 })), _jsx(DiffStat, Object.assign({}, args, { added: 0, deleted: 100 })), _jsx(DiffStat, Object.assign({}, args, { added: 100, deleted: 100 })), _jsx(DiffStat, Object.assign({}, args, { added: 250, deleted: 150 })), _jsx(DiffStat, Object.assign({}, args, { added: 500, deleted: 300 })), _jsx(DiffStat, Object.assign({}, args, { added: 999, deleted: 999 }))] }) }), _jsx(ShowcaseItem, { title: "Thousands", children: _jsxs("div", { style: { display: 'flex', gap: '16px', alignItems: 'center', flexWrap: 'wrap' }, children: [_jsx(DiffStat, Object.assign({}, args, { added: 1000, deleted: 0 })), _jsx(DiffStat, Object.assign({}, args, { added: 0, deleted: 1000 })), _jsx(DiffStat, Object.assign({}, args, { added: 1000, deleted: 1000 })), _jsx(DiffStat, Object.assign({}, args, { added: 2500, deleted: 1500 })), _jsx(DiffStat, Object.assign({}, args, { added: 5000, deleted: 3000 })), _jsx(DiffStat, Object.assign({}, args, { added: 12345, deleted: 6789 }))] }) })] })),
|
|
44
|
+
decorators: defaultDecorators,
|
|
45
|
+
};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { DOMProps, QAProps } from '@gravity-ui/uikit';
|
|
2
|
+
import './DiffStat.scss';
|
|
3
|
+
type DiffStatProps = DOMProps & QAProps & {
|
|
4
|
+
added: number;
|
|
5
|
+
deleted: number;
|
|
6
|
+
};
|
|
7
|
+
export declare const DiffStat: (props: DiffStatProps) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { block } from '../../../utils/cn';
|
|
3
|
+
import './DiffStat.scss';
|
|
4
|
+
const b = block('diff-stat');
|
|
5
|
+
export const DiffStat = (props) => {
|
|
6
|
+
const { added, deleted, className, style, qa } = props;
|
|
7
|
+
return (_jsxs("div", { className: b(null, className), style: style, "data-qa": qa, children: [_jsx("div", { className: b('added', { allow_sign: Boolean(added) }), children: added }), _jsx("div", { className: b('deleted', { allow_sign: Boolean(deleted) }), children: deleted })] }));
|
|
8
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import './Disclaimer.scss';
|
|
2
|
+
/**
|
|
3
|
+
* Props for the Disclaimer component
|
|
4
|
+
*/
|
|
5
|
+
export type DisclaimerProps = React.PropsWithChildren<{
|
|
6
|
+
/** Additional CSS class */
|
|
7
|
+
className?: string;
|
|
8
|
+
/** Disclaimer text to display */
|
|
9
|
+
text?: string;
|
|
10
|
+
/** QA/test identifier */
|
|
11
|
+
qa?: string;
|
|
12
|
+
}>;
|
|
13
|
+
/**
|
|
14
|
+
* Disclaimer component displays informational or warning messages
|
|
15
|
+
*
|
|
16
|
+
* @param props - Component props
|
|
17
|
+
* @returns React component
|
|
18
|
+
*/
|
|
19
|
+
export declare function Disclaimer(props: DisclaimerProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from '@gravity-ui/uikit';
|
|
3
|
+
import { block } from '../../../utils/cn';
|
|
4
|
+
import './Disclaimer.scss';
|
|
5
|
+
const b = block('disclaimer');
|
|
6
|
+
/**
|
|
7
|
+
* Disclaimer component displays informational or warning messages
|
|
8
|
+
*
|
|
9
|
+
* @param props - Component props
|
|
10
|
+
* @returns React component
|
|
11
|
+
*/
|
|
12
|
+
export function Disclaimer(props) {
|
|
13
|
+
const { className, qa, children, text } = props;
|
|
14
|
+
return (_jsxs("div", { className: b('container', className), "data-qa": qa, children: [text && _jsx(Text, { color: "secondary", children: text }), children] }));
|
|
15
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryFn } from '@storybook/react-webpack5';
|
|
2
|
+
import { DisclaimerProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<DisclaimerProps>;
|
|
6
|
+
export declare const WithText: StoryFn<DisclaimerProps>;
|
|
7
|
+
export declare const WithChildren: StoryFn<DisclaimerProps>;
|
|
8
|
+
export declare const WithTextAndChildren: StoryFn<DisclaimerProps>;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Disclaimer } from '..';
|
|
3
|
+
import { ContentWrapper } from '../../../../demo/ContentWrapper';
|
|
4
|
+
import MDXDocs from './Docs.mdx';
|
|
5
|
+
export default {
|
|
6
|
+
title: 'atoms/Disclaimer',
|
|
7
|
+
component: Disclaimer,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
page: MDXDocs,
|
|
11
|
+
},
|
|
12
|
+
},
|
|
13
|
+
argTypes: {
|
|
14
|
+
text: {
|
|
15
|
+
control: 'text',
|
|
16
|
+
description: 'Disclaimer text',
|
|
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(Disclaimer, Object.assign({}, args)) }));
|
|
29
|
+
Playground.args = { text: 'This is a disclaimer text' };
|
|
30
|
+
export const WithText = (args) => (_jsx(ContentWrapper, { children: _jsx(Disclaimer, Object.assign({}, args, { text: "This is an important disclaimer message" })) }));
|
|
31
|
+
export const WithChildren = (args) => (_jsx(ContentWrapper, { children: _jsx(Disclaimer, Object.assign({}, args, { children: _jsx("span", { children: "Custom content goes here" }) })) }));
|
|
32
|
+
export const WithTextAndChildren = (args) => (_jsx(ContentWrapper, { children: _jsx(Disclaimer, Object.assign({}, args, { text: "Disclaimer text", children: _jsx("span", { children: "Additional content" }) })) }));
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Disclaimer';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './Disclaimer';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import './Loader.scss';
|
|
2
|
+
export type LoaderSize = 'xs' | 's' | 'm';
|
|
3
|
+
export interface LoaderProps {
|
|
4
|
+
view?: 'streaming' | 'loading';
|
|
5
|
+
size?: LoaderSize;
|
|
6
|
+
className?: string;
|
|
7
|
+
qa?: string;
|
|
8
|
+
}
|
|
9
|
+
export declare function Loader({ view, size, className, qa }: LoaderProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Spin } from '@gravity-ui/uikit';
|
|
3
|
+
import { block } from '../../../utils/cn';
|
|
4
|
+
import './Loader.scss';
|
|
5
|
+
const b = block('loader');
|
|
6
|
+
export function Loader({ view = 'streaming', size = 's', className, qa }) {
|
|
7
|
+
if (view === 'streaming') {
|
|
8
|
+
return (_jsxs("div", { className: b({ size }, className), "data-qa": qa, children: [_jsx("div", { className: b('left') }), _jsx("div", { className: b('center') }), _jsx("div", { className: b('right') })] }));
|
|
9
|
+
}
|
|
10
|
+
return _jsx(Spin, { size: size, "data-qa": qa, className: b({ view }, className) });
|
|
11
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Meta, StoryFn, StoryObj } from '@storybook/react-webpack5';
|
|
2
|
+
import { LoaderProps } from '..';
|
|
3
|
+
declare const _default: Meta;
|
|
4
|
+
export default _default;
|
|
5
|
+
export declare const Playground: StoryFn<LoaderProps>;
|
|
6
|
+
export declare const Loading: StoryFn<LoaderProps>;
|
|
7
|
+
export declare const Streaming: StoryFn<LoaderProps>;
|
|
8
|
+
export declare const Size: StoryObj<LoaderProps>;
|