@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
@@ -0,0 +1,13 @@
1
+ export declare const i18n: ((key: "show-more-button", params?: import("@gravity-ui/i18n").Params) => string) & {
2
+ Translation: import("react").ComponentType<{
3
+ children: (props: {
4
+ t: (key: "show-more-button", params?: import("@gravity-ui/i18n").Params) => string;
5
+ }) => React.ReactNode;
6
+ }>;
7
+ useTranslation: () => {
8
+ t: (key: "show-more-button", params?: import("@gravity-ui/i18n").Params) => string;
9
+ };
10
+ keysetData: {
11
+ "g-aikit-EmptyContainer": Record<"show-more-button", import("@gravity-ui/i18n").KeyData>;
12
+ };
13
+ };
@@ -0,0 +1,5 @@
1
+ import { addComponentKeysets } from '@gravity-ui/uikit/i18n';
2
+ import { NAMESPACE } from '../../../../utils/cn';
3
+ import en from './en.json';
4
+ import ru from './ru.json';
5
+ export const i18n = addComponentKeysets({ en, ru }, `${NAMESPACE}EmptyContainer`);
@@ -0,0 +1,3 @@
1
+ {
2
+ "show-more-button": "Показать больше примеров"
3
+ }
@@ -0,0 +1 @@
1
+ export * from './EmptyContainer';
@@ -0,0 +1 @@
1
+ export * from './EmptyContainer';
@@ -0,0 +1,17 @@
1
+ import React from 'react';
2
+ import { ChatType } from '../../../types';
3
+ /**
4
+ * Props for ChatItem component
5
+ */
6
+ export interface ChatItemProps {
7
+ chat: ChatType;
8
+ showActions: boolean;
9
+ onChatClick: (chat: ChatType) => void;
10
+ onDeleteClick?: (e: React.MouseEvent, chat: ChatType) => void;
11
+ }
12
+ /**
13
+ * Chat item component with hover state for actions
14
+ *
15
+ * @returns React element
16
+ */
17
+ export declare function ChatItem({ chat, showActions, onChatClick, onDeleteClick }: ChatItemProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,18 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import React from 'react';
3
+ import { TrashBin } from '@gravity-ui/icons';
4
+ import { Icon, Text } from '@gravity-ui/uikit';
5
+ import { block } from '../../../utils/cn';
6
+ import { ActionButton } from '../../atoms/ActionButton';
7
+ import { i18n } from './i18n';
8
+ const b = block('history');
9
+ /**
10
+ * Chat item component with hover state for actions
11
+ *
12
+ * @returns React element
13
+ */
14
+ export function ChatItem({ chat, showActions, onChatClick, onDeleteClick }) {
15
+ const [isHovered, setIsHovered] = React.useState(false);
16
+ const showDeleteButton = showActions && onDeleteClick && isHovered;
17
+ return (_jsxs("div", { className: b('chat-item'), onClick: () => onChatClick(chat), onMouseEnter: () => setIsHovered(true), onMouseLeave: () => setIsHovered(false), children: [_jsx("div", { className: b('chat-content'), children: _jsx(Text, { variant: "body-1", children: chat.lastMessage || chat.name }) }), showDeleteButton && (_jsx(ActionButton, { view: "flat", size: "s", color: "secondary", className: b('delete-button'), onClick: (e) => onDeleteClick(e, chat), tooltipTitle: i18n('tooltip-delete'), children: _jsx(Icon, { className: b('icon-button'), data: TrashBin, size: 16 }) }))] }));
18
+ }
@@ -0,0 +1,12 @@
1
+ /**
2
+ * Props for DateHeaderItem component
3
+ */
4
+ export interface DateHeaderItemProps {
5
+ date: string;
6
+ }
7
+ /**
8
+ * Date header component for grouping chats
9
+ *
10
+ * @returns React element
11
+ */
12
+ export declare function DateHeaderItem({ date }: DateHeaderItemProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { block } from '../../../utils/cn';
3
+ import { ChatDate } from '../../atoms/ChatDate';
4
+ const b = block('history');
5
+ /**
6
+ * Date header component for grouping chats
7
+ *
8
+ * @returns React element
9
+ */
10
+ export function DateHeaderItem({ date }) {
11
+ return (_jsx("div", { className: b('date-header'), children: _jsx(ChatDate, { date: new Date(date), relative: true }) }));
12
+ }
@@ -0,0 +1,46 @@
1
+ import React from 'react';
2
+ import { DOMProps, QAProps } from '@gravity-ui/uikit';
3
+ import { ChatType } from '../../../types';
4
+ import { ChatFilterFunction } from '../../../utils/chatUtils';
5
+ /**
6
+ * Props for the History component
7
+ */
8
+ export interface HistoryProps extends QAProps, DOMProps {
9
+ /** Array of chat items */
10
+ chats: ChatType[];
11
+ /** Currently selected chat */
12
+ selectedChat?: ChatType | null;
13
+ /** Callback when a chat is selected */
14
+ onSelectChat?: (chat: ChatType) => void;
15
+ /** Callback when a chat is deleted */
16
+ onDeleteChat?: (chat: ChatType) => void;
17
+ /** Callback to load more chats */
18
+ onLoadMore?: () => void;
19
+ /** Whether there are more chats to load */
20
+ hasMore?: boolean;
21
+ /** Enable search functionality */
22
+ searchable?: boolean;
23
+ /** Group chats by date or none */
24
+ groupBy?: 'date' | 'none';
25
+ /** Show action buttons (delete, etc.) */
26
+ showActions?: boolean;
27
+ /** Empty state placeholder */
28
+ emptyPlaceholder?: React.ReactNode;
29
+ /** Additional CSS class */
30
+ className?: string;
31
+ /** Custom filter function for search */
32
+ filterFunction?: ChatFilterFunction;
33
+ /** Control popup open state */
34
+ open?: boolean;
35
+ /** Callback when popup open state changes */
36
+ onOpenChange?: (open: boolean) => void;
37
+ /** Anchor element for the popup */
38
+ anchorElement: HTMLElement | null;
39
+ }
40
+ /**
41
+ * History component - wraps HistoryList in a Popup
42
+ *
43
+ * @param props - Component props
44
+ * @returns React component
45
+ */
46
+ export declare function History(props: HistoryProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,16 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { Popup } from '@gravity-ui/uikit';
3
+ import { HistoryList } from './HistoryList';
4
+ /**
5
+ * History component - wraps HistoryList in a Popup
6
+ *
7
+ * @param props - Component props
8
+ * @returns React component
9
+ */
10
+ export function History(props) {
11
+ const { chats, selectedChat, onSelectChat, onDeleteChat, onLoadMore, hasMore = false, searchable = true, groupBy = 'date', showActions = true, emptyPlaceholder, className, qa, style, filterFunction, open = false, onOpenChange, anchorElement, } = props;
12
+ const handleChatClick = () => {
13
+ onOpenChange === null || onOpenChange === void 0 ? void 0 : onOpenChange(false);
14
+ };
15
+ return (_jsx(Popup, { anchorElement: anchorElement, placement: "bottom-end", open: open, onOpenChange: onOpenChange, children: _jsx(HistoryList, { chats: chats, selectedChat: selectedChat, onSelectChat: onSelectChat, onDeleteChat: onDeleteChat, onLoadMore: onLoadMore, hasMore: hasMore, searchable: searchable, groupBy: groupBy, showActions: showActions, emptyPlaceholder: emptyPlaceholder, className: className, qa: qa, style: style, filterFunction: filterFunction, onChatClick: handleChatClick }) }));
16
+ }
@@ -0,0 +1,43 @@
1
+ import React from 'react';
2
+ import { DOMProps, QAProps } from '@gravity-ui/uikit';
3
+ import { ChatType } from '../../../types';
4
+ import { ChatFilterFunction } from '../../../utils/chatUtils';
5
+ import './History.scss';
6
+ /**
7
+ * Props for the HistoryList component
8
+ */
9
+ export interface HistoryListProps extends QAProps, DOMProps {
10
+ /** Array of chat items */
11
+ chats: ChatType[];
12
+ /** Currently selected chat */
13
+ selectedChat?: ChatType | null;
14
+ /** Callback when a chat is selected */
15
+ onSelectChat?: (chat: ChatType) => void;
16
+ /** Callback when a chat is deleted */
17
+ onDeleteChat?: (chat: ChatType) => void;
18
+ /** Callback to load more chats */
19
+ onLoadMore?: () => void;
20
+ /** Whether there are more chats to load */
21
+ hasMore?: boolean;
22
+ /** Enable search functionality */
23
+ searchable?: boolean;
24
+ /** Group chats by date or none */
25
+ groupBy?: 'date' | 'none';
26
+ /** Show action buttons (delete, etc.) */
27
+ showActions?: boolean;
28
+ /** Empty state placeholder */
29
+ emptyPlaceholder?: React.ReactNode;
30
+ /** Additional CSS class */
31
+ className?: string;
32
+ /** Custom filter function for search */
33
+ filterFunction?: ChatFilterFunction;
34
+ /** Callback when chat is clicked (for closing popup in parent) */
35
+ onChatClick?: (chat: ChatType) => void;
36
+ }
37
+ /**
38
+ * HistoryList component - displays a list of chats with search, grouping, and actions
39
+ *
40
+ * @param props - Component props
41
+ * @returns React component
42
+ */
43
+ export declare function HistoryList(props: HistoryListProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,87 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { useMemo } from 'react';
3
+ import { Button, List } from '@gravity-ui/uikit';
4
+ import { defaultChatFilter, groupChatsByDate } from '../../../utils/chatUtils';
5
+ import { block } from '../../../utils/cn';
6
+ import { ChatItem } from './ChatItem';
7
+ import { DateHeaderItem } from './DateHeaderItem';
8
+ import { i18n } from './i18n';
9
+ import './History.scss';
10
+ const b = block('history');
11
+ /**
12
+ * HistoryList component - displays a list of chats with search, grouping, and actions
13
+ *
14
+ * @param props - Component props
15
+ * @returns React component
16
+ */
17
+ export function HistoryList(props) {
18
+ const { chats, selectedChat, onSelectChat, onDeleteChat, onLoadMore, hasMore = false, searchable = true, groupBy = 'date', showActions = true, emptyPlaceholder, className, qa, style, filterFunction = defaultChatFilter, onChatClick, } = props;
19
+ // Group chats if needed
20
+ const groupedChats = useMemo(() => {
21
+ if (groupBy === 'none') {
22
+ return new Map([['all', chats]]);
23
+ }
24
+ return groupChatsByDate(chats);
25
+ }, [chats, groupBy]);
26
+ // Convert grouped chats to list items
27
+ const listItems = useMemo(() => {
28
+ const items = [];
29
+ // Sort groups by date (newest first)
30
+ const sortedGroups = Array.from(groupedChats.entries()).sort(([dateA], [dateB]) => {
31
+ if (dateA === 'all')
32
+ return 0;
33
+ return new Date(dateB).getTime() - new Date(dateA).getTime();
34
+ });
35
+ sortedGroups.forEach(([dateKey, groupChats]) => {
36
+ // Skip empty groups (important for filtering)
37
+ if (groupChats.length === 0) {
38
+ return;
39
+ }
40
+ // Add date header for grouped view only if there are chats in this group
41
+ if (groupBy === 'date' && dateKey !== 'all') {
42
+ items.push({
43
+ type: 'date-header',
44
+ disabled: true,
45
+ date: dateKey,
46
+ });
47
+ }
48
+ // Add chat items
49
+ groupChats.forEach((chat) => {
50
+ items.push(Object.assign({ type: 'chat' }, chat));
51
+ });
52
+ });
53
+ return items;
54
+ }, [groupedChats, groupBy]);
55
+ const selectedItemIndex = useMemo(() => {
56
+ return listItems.findIndex((item) => item.type === 'chat' && item.id === (selectedChat === null || selectedChat === void 0 ? void 0 : selectedChat.id));
57
+ }, [listItems, selectedChat]);
58
+ const handleChatClick = (chat) => {
59
+ onSelectChat === null || onSelectChat === void 0 ? void 0 : onSelectChat(chat);
60
+ onChatClick === null || onChatClick === void 0 ? void 0 : onChatClick(chat);
61
+ };
62
+ const handleDeleteClick = (e, chat) => {
63
+ e.stopPropagation();
64
+ onDeleteChat === null || onDeleteChat === void 0 ? void 0 : onDeleteChat(chat);
65
+ };
66
+ // Wrap filter function to hide date headers when filter is active
67
+ const wrappedFilterFunction = useMemo(() => {
68
+ return (filter) => {
69
+ const userFilter = filterFunction(filter);
70
+ return (item) => {
71
+ // Hide date headers when searching (they will be empty after chat filtering)
72
+ if (filter && item.type === 'date-header') {
73
+ return false;
74
+ }
75
+ return userFilter(item);
76
+ };
77
+ };
78
+ }, [filterFunction]);
79
+ const renderItem = (item) => {
80
+ if (item.type === 'date-header') {
81
+ return _jsx(DateHeaderItem, { date: item.date }, `date-${item.date}`);
82
+ }
83
+ return (_jsx(ChatItem, { chat: item, showActions: showActions, onChatClick: handleChatClick, onDeleteClick: onDeleteChat ? handleDeleteClick : undefined }, item.id));
84
+ };
85
+ const emptyState = emptyPlaceholder || _jsx("div", { className: b('empty'), children: i18n('empty-state') });
86
+ return (_jsxs("div", { className: b('container', className), "data-qa": qa, style: style, children: [_jsx("div", { className: b('list-wrapper'), children: _jsx(List, { items: listItems, renderItem: renderItem, virtualized: false, filterable: searchable, filterItem: wrappedFilterFunction, filterPlaceholder: i18n('search-placeholder'), filterClassName: b('filter'), emptyPlaceholder: emptyState, selectedItemIndex: selectedItemIndex, itemsClassName: b('list'), itemClassName: b('list-item') }) }), hasMore && onLoadMore && (_jsx(Button, { view: "flat-action", size: "m", width: "max", onClick: onLoadMore, children: i18n('action-load-more') }))] }));
87
+ }
@@ -0,0 +1,17 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { History } from '..';
3
+ declare const _default: Meta;
4
+ export default _default;
5
+ type Story = StoryObj<typeof History>;
6
+ export declare const Playground: Story;
7
+ export declare const WithSelectedChat: Story;
8
+ export declare const WithLoadMore: Story;
9
+ export declare const WithoutSearch: Story;
10
+ export declare const WithoutGrouping: Story;
11
+ export declare const WithoutActions: Story;
12
+ export declare const EmptyState: Story;
13
+ export declare const WithLoadMoreAndDelete: Story;
14
+ export declare const Interactive: Story;
15
+ export declare const WithCustomEmptyPlaceholder: Story;
16
+ export declare const WithCustomFilter: Story;
17
+ export declare const NotForceOpen: Story;
@@ -0,0 +1,281 @@
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, jsxs as _jsxs } from "react/jsx-runtime";
13
+ import { useRef, useState } from 'react';
14
+ import { ClockArrowRotateLeft } from '@gravity-ui/icons';
15
+ import { Icon } from '@gravity-ui/uikit';
16
+ import { History } from '..';
17
+ import { ContentWrapper } from '../../../../demo/ContentWrapper';
18
+ import { ActionButton } from '../../../atoms/ActionButton';
19
+ import MDXDocs from './Docs.mdx';
20
+ export default {
21
+ title: 'templates/History',
22
+ component: History,
23
+ parameters: {
24
+ docs: {
25
+ page: MDXDocs,
26
+ },
27
+ },
28
+ };
29
+ // Generate mock chats
30
+ const generateMockChats = (count) => {
31
+ const now = new Date();
32
+ const chats = [];
33
+ for (let i = 0; i < count; i++) {
34
+ const daysAgo = Math.floor(i / 3); // Group 3 chats per day
35
+ const date = new Date(now);
36
+ date.setDate(date.getDate() - daysAgo);
37
+ chats.push({
38
+ id: `chat-${i}`,
39
+ name: `Chat ${i + 1}`,
40
+ createTime: date.toISOString(),
41
+ lastMessage: i % 3 === 0
42
+ ? `Looooooooong last message for example ellipsis from chat ${i + 1}`
43
+ : `Last message from chat ${i + 1}`,
44
+ metadata: {},
45
+ });
46
+ }
47
+ return chats;
48
+ };
49
+ const mockChats = generateMockChats(15);
50
+ function HistoryWithTrigger(_a) {
51
+ var { initialOpen = true } = _a, props = __rest(_a, ["initialOpen"]);
52
+ const [open, setOpen] = useState(initialOpen);
53
+ const anchorRef = useRef(null);
54
+ return (_jsxs("div", { style: { paddingLeft: '400px' }, children: [_jsx(ActionButton, { ref: anchorRef, view: "flat", size: "m", onClick: () => setOpen(!open), tooltipTitle: "Chat History", children: _jsx(Icon, { data: ClockArrowRotateLeft, size: 16 }) }), _jsx(History, Object.assign({}, props, { open: open, onOpenChange: setOpen, anchorElement: anchorRef.current }))] }));
55
+ }
56
+ const defaultDecorators = [
57
+ (Story) => (_jsx(ContentWrapper, { width: "600px", height: "800px", children: _jsx(Story, {}) })),
58
+ ];
59
+ export const Playground = {
60
+ args: {
61
+ chats: mockChats,
62
+ searchable: true,
63
+ groupBy: 'date',
64
+ showActions: true,
65
+ onSelectChat: (chat) => {
66
+ // eslint-disable-next-line no-console
67
+ console.log('Selected chat:', chat);
68
+ },
69
+ onDeleteChat: (chat) => {
70
+ // eslint-disable-next-line no-console
71
+ console.log('Delete chat:', chat);
72
+ },
73
+ },
74
+ render: (args) => _jsx(HistoryWithTrigger, Object.assign({}, args)),
75
+ decorators: defaultDecorators,
76
+ };
77
+ export const WithSelectedChat = {
78
+ args: {
79
+ chats: mockChats,
80
+ selectedChat: mockChats[2],
81
+ searchable: true,
82
+ groupBy: 'date',
83
+ showActions: true,
84
+ onSelectChat: (chat) => {
85
+ // eslint-disable-next-line no-console
86
+ console.log('Selected chat:', chat);
87
+ },
88
+ },
89
+ render: (args) => _jsx(HistoryWithTrigger, Object.assign({}, args)),
90
+ decorators: defaultDecorators,
91
+ };
92
+ export const WithLoadMore = {
93
+ args: {
94
+ searchable: true,
95
+ groupBy: 'date',
96
+ showActions: true,
97
+ onSelectChat: (chat) => {
98
+ // eslint-disable-next-line no-console
99
+ console.log('Selected chat:', chat);
100
+ },
101
+ },
102
+ render: (args) => {
103
+ const [chats, setChats] = useState(mockChats.slice(0, 6));
104
+ const [hasMore, setHasMore] = useState(true);
105
+ const handleLoadMore = () => {
106
+ // eslint-disable-next-line no-console
107
+ console.log('Loading more chats...');
108
+ const currentLength = chats.length;
109
+ const nextChats = mockChats.slice(0, currentLength + 6);
110
+ setChats(nextChats);
111
+ if (nextChats.length >= mockChats.length) {
112
+ setHasMore(false);
113
+ }
114
+ };
115
+ return (_jsx(HistoryWithTrigger, Object.assign({}, args, { chats: chats, hasMore: hasMore, onLoadMore: handleLoadMore })));
116
+ },
117
+ decorators: defaultDecorators,
118
+ };
119
+ export const WithoutSearch = {
120
+ args: {
121
+ chats: mockChats,
122
+ searchable: false,
123
+ groupBy: 'date',
124
+ showActions: true,
125
+ onSelectChat: (chat) => {
126
+ // eslint-disable-next-line no-console
127
+ console.log('Selected chat:', chat);
128
+ },
129
+ },
130
+ render: (args) => _jsx(HistoryWithTrigger, Object.assign({}, args)),
131
+ decorators: defaultDecorators,
132
+ };
133
+ export const WithoutGrouping = {
134
+ args: {
135
+ chats: mockChats,
136
+ searchable: true,
137
+ groupBy: 'none',
138
+ showActions: true,
139
+ onSelectChat: (chat) => {
140
+ // eslint-disable-next-line no-console
141
+ console.log('Selected chat:', chat);
142
+ },
143
+ },
144
+ render: (args) => _jsx(HistoryWithTrigger, Object.assign({}, args)),
145
+ decorators: defaultDecorators,
146
+ };
147
+ export const WithoutActions = {
148
+ args: {
149
+ chats: mockChats,
150
+ searchable: true,
151
+ groupBy: 'date',
152
+ showActions: false,
153
+ onSelectChat: (chat) => {
154
+ // eslint-disable-next-line no-console
155
+ console.log('Selected chat:', chat);
156
+ },
157
+ },
158
+ render: (args) => _jsx(HistoryWithTrigger, Object.assign({}, args)),
159
+ decorators: defaultDecorators,
160
+ };
161
+ export const EmptyState = {
162
+ args: {
163
+ chats: [],
164
+ searchable: true,
165
+ groupBy: 'date',
166
+ showActions: true,
167
+ },
168
+ render: (args) => _jsx(HistoryWithTrigger, Object.assign({}, args)),
169
+ decorators: defaultDecorators,
170
+ };
171
+ export const WithLoadMoreAndDelete = {
172
+ args: {
173
+ chats: mockChats,
174
+ searchable: true,
175
+ groupBy: 'date',
176
+ showActions: true,
177
+ hasMore: true,
178
+ onSelectChat: (chat) => {
179
+ // eslint-disable-next-line no-console
180
+ console.log('Selected chat:', chat);
181
+ },
182
+ onDeleteChat: (chat) => {
183
+ // eslint-disable-next-line no-console
184
+ console.log('Delete chat:', chat);
185
+ },
186
+ onLoadMore: () => {
187
+ // eslint-disable-next-line no-console
188
+ console.log('Load more chats');
189
+ },
190
+ },
191
+ render: (args) => _jsx(HistoryWithTrigger, Object.assign({}, args)),
192
+ decorators: defaultDecorators,
193
+ };
194
+ export const Interactive = {
195
+ args: {
196
+ searchable: true,
197
+ groupBy: 'date',
198
+ showActions: true,
199
+ },
200
+ render: (args) => {
201
+ const [chats, setChats] = useState(mockChats);
202
+ const [selectedChat, setSelectedChat] = useState(null);
203
+ const handleDeleteChat = (chat) => {
204
+ setChats((prev) => prev.filter((c) => c.id !== chat.id));
205
+ if ((selectedChat === null || selectedChat === void 0 ? void 0 : selectedChat.id) === chat.id) {
206
+ setSelectedChat(null);
207
+ }
208
+ };
209
+ return (_jsx(HistoryWithTrigger, Object.assign({}, args, { chats: chats, selectedChat: selectedChat, onSelectChat: setSelectedChat, onDeleteChat: handleDeleteChat })));
210
+ },
211
+ decorators: defaultDecorators,
212
+ };
213
+ export const WithCustomEmptyPlaceholder = {
214
+ args: {
215
+ chats: [],
216
+ searchable: true,
217
+ groupBy: 'date',
218
+ showActions: true,
219
+ emptyPlaceholder: (_jsxs("div", { style: {
220
+ padding: '40px',
221
+ color: '#999',
222
+ width: '100%',
223
+ display: 'flex',
224
+ flexDirection: 'column',
225
+ alignItems: 'center',
226
+ justifyContent: 'center',
227
+ }, children: [_jsx("div", { style: {
228
+ fontSize: '48px',
229
+ height: '48px',
230
+ display: 'flex',
231
+ alignItems: 'center',
232
+ justifyContent: 'center',
233
+ marginBottom: '16px',
234
+ }, children: "\uD83D\uDCAC" }), _jsx("div", { style: {
235
+ fontSize: '16px',
236
+ fontWeight: 'bold',
237
+ marginBottom: '8px',
238
+ }, children: "No conversations yet" }), _jsx("div", { style: { fontSize: '14px' }, children: "Start a new chat to begin" })] })),
239
+ },
240
+ render: (args) => _jsx(HistoryWithTrigger, Object.assign({}, args)),
241
+ decorators: defaultDecorators,
242
+ };
243
+ export const WithCustomFilter = {
244
+ args: {
245
+ chats: mockChats,
246
+ searchable: true,
247
+ groupBy: 'date',
248
+ showActions: true,
249
+ onSelectChat: (chat) => {
250
+ // eslint-disable-next-line no-console
251
+ console.log('Selected chat:', chat);
252
+ },
253
+ // Custom filter that searches only in chat names (not in messages)
254
+ filterFunction: (filter) => (item) => {
255
+ if (item.type === 'date-header') {
256
+ return true;
257
+ }
258
+ return item.name.toLowerCase().includes(filter.toLowerCase());
259
+ },
260
+ },
261
+ render: (args) => _jsx(HistoryWithTrigger, Object.assign({}, args)),
262
+ decorators: defaultDecorators,
263
+ };
264
+ export const NotForceOpen = {
265
+ args: {
266
+ chats: mockChats,
267
+ searchable: true,
268
+ groupBy: 'date',
269
+ showActions: true,
270
+ onSelectChat: (chat) => {
271
+ // eslint-disable-next-line no-console
272
+ console.log('Selected chat:', chat);
273
+ },
274
+ onDeleteChat: (chat) => {
275
+ // eslint-disable-next-line no-console
276
+ console.log('Delete chat:', chat);
277
+ },
278
+ },
279
+ render: (args) => _jsx(HistoryWithTrigger, Object.assign({ initialOpen: false }, args)),
280
+ decorators: defaultDecorators,
281
+ };
@@ -0,0 +1,7 @@
1
+ {
2
+ "action-load-more": "Load earlier conversations",
3
+ "search-placeholder": "Search your chats",
4
+ "empty-state": "No chats found",
5
+ "tooltip-history": "Chat history",
6
+ "tooltip-delete": "Delete"
7
+ }
@@ -0,0 +1,13 @@
1
+ export declare const i18n: ((key: "action-load-more" | "search-placeholder" | "empty-state" | "tooltip-history" | "tooltip-delete", params?: import("@gravity-ui/i18n").Params) => string) & {
2
+ Translation: import("react").ComponentType<{
3
+ children: (props: {
4
+ t: (key: "action-load-more" | "search-placeholder" | "empty-state" | "tooltip-history" | "tooltip-delete", params?: import("@gravity-ui/i18n").Params) => string;
5
+ }) => React.ReactNode;
6
+ }>;
7
+ useTranslation: () => {
8
+ t: (key: "action-load-more" | "search-placeholder" | "empty-state" | "tooltip-history" | "tooltip-delete", params?: import("@gravity-ui/i18n").Params) => string;
9
+ };
10
+ keysetData: {
11
+ "g-aikit-History": Record<"action-load-more" | "search-placeholder" | "empty-state" | "tooltip-history" | "tooltip-delete", import("@gravity-ui/i18n").KeyData>;
12
+ };
13
+ };
@@ -0,0 +1,5 @@
1
+ import { addComponentKeysets } from '@gravity-ui/uikit/i18n';
2
+ import { NAMESPACE } from '../../../../utils/cn';
3
+ import en from './en.json';
4
+ import ru from './ru.json';
5
+ export const i18n = addComponentKeysets({ en, ru }, `${NAMESPACE}History`);
@@ -0,0 +1,7 @@
1
+ {
2
+ "action-load-more": "Загрузить еще",
3
+ "search-placeholder": "Поиск по чатам",
4
+ "empty-state": "Чаты не найдены",
5
+ "tooltip-history": "История чатов",
6
+ "tooltip-delete": "Удалить"
7
+ }
@@ -0,0 +1,8 @@
1
+ export { History } from './History';
2
+ export type { HistoryProps } from './History';
3
+ export { HistoryList } from './HistoryList';
4
+ export type { HistoryListProps } from './HistoryList';
5
+ export { ChatItem } from './ChatItem';
6
+ export type { ChatItemProps } from './ChatItem';
7
+ export { DateHeaderItem } from './DateHeaderItem';
8
+ export type { DateHeaderItemProps } from './DateHeaderItem';
@@ -0,0 +1,4 @@
1
+ export { History } from './History';
2
+ export { HistoryList } from './HistoryList';
3
+ export { ChatItem } from './ChatItem';
4
+ export { DateHeaderItem } from './DateHeaderItem';
@@ -0,0 +1,3 @@
1
+ export * from './ChatContent';
2
+ export * from './EmptyContainer';
3
+ export * from './History';
@@ -0,0 +1,4 @@
1
+ // Export all templates
2
+ export * from './ChatContent';
3
+ export * from './EmptyContainer';
4
+ export * from './History';
@@ -0,0 +1 @@
1
+ export declare const RELATIVE_DATE_THRESHOLD = 7;