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