@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,66 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { BaseMessage } from '..';
3
+ import { ContentWrapper } from '../../../../demo/ContentWrapper';
4
+ import { Showcase } from '../../../../demo/Showcase';
5
+ import { ShowcaseItem } from '../../../../demo/ShowcaseItem';
6
+ import MDXDocs from './Docs.mdx';
7
+ export default {
8
+ title: 'molecules/BaseMessage',
9
+ component: BaseMessage,
10
+ parameters: {
11
+ docs: {
12
+ page: MDXDocs,
13
+ },
14
+ },
15
+ argTypes: {
16
+ variant: {
17
+ control: 'radio',
18
+ options: ['user', 'assistant', 'system'],
19
+ description: 'Type of message',
20
+ },
21
+ showActionsOnHover: {
22
+ control: 'boolean',
23
+ description: 'Show actions on hover',
24
+ },
25
+ className: {
26
+ control: 'text',
27
+ description: 'Additional CSS class',
28
+ },
29
+ qa: {
30
+ control: 'text',
31
+ description: 'QA/test identifier',
32
+ },
33
+ },
34
+ };
35
+ const defaultDecorators = [
36
+ (Story) => (_jsx(ContentWrapper, { children: _jsx(Showcase, { children: _jsx(Story, {}) }) })),
37
+ ];
38
+ const buttons = [
39
+ // eslint-disable-next-line no-console
40
+ { type: 'copy', onClick: () => console.log('copy') },
41
+ // eslint-disable-next-line no-console
42
+ { type: 'edit', onClick: () => console.log('edit') },
43
+ // eslint-disable-next-line no-console
44
+ { type: 'delete', onClick: () => console.log('delete') },
45
+ // eslint-disable-next-line no-console
46
+ { type: 'custom', onClick: () => console.log('custom') },
47
+ // eslint-disable-next-line no-console
48
+ { type: 'like', onClick: () => console.log('like') },
49
+ // eslint-disable-next-line no-console
50
+ { type: 'unlike', onClick: () => console.log('unlike') },
51
+ ];
52
+ export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(BaseMessage, Object.assign({}, args)) }));
53
+ Playground.args = {
54
+ children: 'My message',
55
+ actions: buttons,
56
+ role: 'assistant',
57
+ };
58
+ export const Variant = {
59
+ render: (args) => (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "User", children: _jsx(BaseMessage, Object.assign({}, args, { actions: buttons, role: "user", children: 'My message' })) }), _jsx(ShowcaseItem, { title: "Assistant", children: _jsx(BaseMessage, Object.assign({}, args, { actions: buttons, role: "assistant", children: 'My message' })) }), _jsx(ShowcaseItem, { title: "System", children: _jsx(BaseMessage, Object.assign({}, args, { actions: buttons, role: "system", children: 'My message' })) })] })),
60
+ decorators: defaultDecorators,
61
+ };
62
+ export const ShowActionsOnHover = (args) => (_jsx(ContentWrapper, { children: _jsx(BaseMessage, Object.assign({}, args, { actions: buttons, role: "assistant", showActionsOnHover: true, children: 'My message' })) }));
63
+ export const ShowTimestamp = {
64
+ render: (args) => (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "User", children: _jsx(BaseMessage, Object.assign({}, args, { actions: buttons, role: "user", showTimestamp: true, timestamp: "1705312234567", children: 'My message' })) }), _jsx(ShowcaseItem, { title: "Assistant", children: _jsx(BaseMessage, Object.assign({}, args, { actions: buttons, role: "assistant", showTimestamp: true, timestamp: "1705312234567", children: 'My message' })) })] })),
65
+ decorators: defaultDecorators,
66
+ };
@@ -0,0 +1,8 @@
1
+ {
2
+ "action-tooltip-copy": "Copy",
3
+ "action-tooltip-edit": "Edit",
4
+ "action-tooltip-retry": "Retry",
5
+ "action-tooltip-like": "Like",
6
+ "action-tooltip-unlike": "Dislike",
7
+ "action-tooltip-delete": "Delete"
8
+ }
@@ -0,0 +1,13 @@
1
+ export declare const i18n: ((key: "action-tooltip-copy" | "action-tooltip-edit" | "action-tooltip-retry" | "action-tooltip-like" | "action-tooltip-unlike" | "action-tooltip-delete", params?: import("@gravity-ui/i18n").Params) => string) & {
2
+ Translation: import("react").ComponentType<{
3
+ children: (props: {
4
+ t: (key: "action-tooltip-copy" | "action-tooltip-edit" | "action-tooltip-retry" | "action-tooltip-like" | "action-tooltip-unlike" | "action-tooltip-delete", params?: import("@gravity-ui/i18n").Params) => string;
5
+ }) => React.ReactNode;
6
+ }>;
7
+ useTranslation: () => {
8
+ t: (key: "action-tooltip-copy" | "action-tooltip-edit" | "action-tooltip-retry" | "action-tooltip-like" | "action-tooltip-unlike" | "action-tooltip-delete", params?: import("@gravity-ui/i18n").Params) => string;
9
+ };
10
+ keysetData: {
11
+ "g-aikit-BaseMessage": Record<"action-tooltip-copy" | "action-tooltip-edit" | "action-tooltip-retry" | "action-tooltip-like" | "action-tooltip-unlike" | "action-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}BaseMessage`);
@@ -0,0 +1,8 @@
1
+ {
2
+ "action-tooltip-copy": "Копировать",
3
+ "action-tooltip-edit": "Редактировать",
4
+ "action-tooltip-retry": "Повторить",
5
+ "action-tooltip-like": "Нравится",
6
+ "action-tooltip-unlike": "Не нравится",
7
+ "action-tooltip-delete": "Удалить"
8
+ }
@@ -0,0 +1,11 @@
1
+ import type { BaseMessageProps } from '../../../types/messages';
2
+ import './BaseMessage.scss';
3
+ export declare enum BaseMessageAction {
4
+ Copy = "copy",
5
+ Edit = "edit",
6
+ Retry = "retry",
7
+ Like = "like",
8
+ Unlike = "unlike",
9
+ Delete = "delete"
10
+ }
11
+ export declare const BaseMessage: (props: BaseMessageProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,48 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { ArrowRotateLeft, Copy as CopyIcon, Pencil, ThumbsDown, ThumbsUp, TrashBin, } from '@gravity-ui/icons';
3
+ import { Icon } from '@gravity-ui/uikit';
4
+ import { block } from '../../../utils/cn';
5
+ import { ActionButton } from '../../atoms';
6
+ import { ChatDate } from '../../atoms/ChatDate';
7
+ import { ButtonGroup } from '../ButtonGroup';
8
+ import { i18n } from './i18n';
9
+ import './BaseMessage.scss';
10
+ const b = block('base-message');
11
+ export var BaseMessageAction;
12
+ (function (BaseMessageAction) {
13
+ BaseMessageAction["Copy"] = "copy";
14
+ BaseMessageAction["Edit"] = "edit";
15
+ BaseMessageAction["Retry"] = "retry";
16
+ BaseMessageAction["Like"] = "like";
17
+ BaseMessageAction["Unlike"] = "unlike";
18
+ BaseMessageAction["Delete"] = "delete";
19
+ })(BaseMessageAction || (BaseMessageAction = {}));
20
+ const BaseMessageActionIcons = {
21
+ [BaseMessageAction.Copy]: CopyIcon,
22
+ [BaseMessageAction.Edit]: Pencil,
23
+ [BaseMessageAction.Retry]: ArrowRotateLeft,
24
+ [BaseMessageAction.Like]: ThumbsUp,
25
+ [BaseMessageAction.Unlike]: ThumbsDown,
26
+ [BaseMessageAction.Delete]: TrashBin,
27
+ };
28
+ export const BaseMessage = (props) => {
29
+ const { className, qa, showActionsOnHover, actions, children, role: variant, showTimestamp, timestamp = '', } = props;
30
+ // Get tooltip text for action
31
+ const getTooltipText = (actionType) => {
32
+ const tooltipKey = `action-tooltip-${actionType}`;
33
+ // Check if tooltip exists in i18n, otherwise return empty string
34
+ try {
35
+ return i18n(tooltipKey);
36
+ }
37
+ catch (_a) {
38
+ return '';
39
+ }
40
+ };
41
+ const hasActions = actions && actions.length > 0;
42
+ return (_jsxs("div", { className: b({ variant, 'btn-hover': showActionsOnHover }, className), "data-qa": qa, children: [children, hasActions && (_jsxs("div", { className: b('actions', { reverse: variant !== 'user' }), children: [showTimestamp ? _jsx(ChatDate, { date: timestamp, format: "HH:mm", showTime: true }) : null, _jsx(ButtonGroup, { children: actions === null || actions === void 0 ? void 0 : actions.map((action) => {
43
+ const tooltipText = getTooltipText(action.type);
44
+ return (_jsx(ActionButton, { tooltipTitle: tooltipText && action.type !== 'custom'
45
+ ? tooltipText
46
+ : undefined, view: "flat-secondary", onClick: action.onClick, children: action.icon || BaseMessageActionIcons[action.type] ? (_jsx(Icon, { size: 16, data: action.icon || BaseMessageActionIcons[action.type] })) : (action.type) }, action.type));
47
+ }) })] }))] }));
48
+ };
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryFn, StoryObj } from '@storybook/react-webpack5';
2
+ import { type ButtonGroupProps } from '..';
3
+ declare const _default: Meta;
4
+ export default _default;
5
+ export declare const Playground: StoryFn<ButtonGroupProps>;
6
+ export declare const Orientation: StoryObj<ButtonGroupProps>;
@@ -0,0 +1,44 @@
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Button } from '@gravity-ui/uikit';
3
+ import { ButtonGroup } from '..';
4
+ import { ContentWrapper } from '../../../../demo/ContentWrapper';
5
+ import { Showcase } from '../../../../demo/Showcase';
6
+ import { ShowcaseItem } from '../../../../demo/ShowcaseItem';
7
+ import MDXDocs from './Docs.mdx';
8
+ export default {
9
+ title: 'molecules/ButtonGroup',
10
+ component: ButtonGroup,
11
+ parameters: {
12
+ docs: {
13
+ page: MDXDocs,
14
+ },
15
+ },
16
+ argTypes: {
17
+ orientation: {
18
+ control: 'radio',
19
+ options: ['horizontal', 'vertical'],
20
+ description: 'Orientation of buttons',
21
+ },
22
+ className: {
23
+ control: 'text',
24
+ description: 'Additional CSS class',
25
+ },
26
+ qa: {
27
+ control: 'text',
28
+ description: 'QA/test identifier',
29
+ },
30
+ },
31
+ };
32
+ const defaultDecorators = [
33
+ (Story) => (_jsx(ContentWrapper, { children: _jsx(Showcase, { children: _jsx(Story, {}) }) })),
34
+ ];
35
+ const buttonChildren = (_jsxs(_Fragment, { children: [_jsx(Button, { children: "Button 1" }), _jsx(Button, { children: "Button 2" }), _jsx(Button, { children: "Button 3" })] }));
36
+ export const Playground = (args) => (_jsx(ContentWrapper, { children: _jsx(ButtonGroup, Object.assign({}, args)) }));
37
+ Playground.args = {
38
+ children: buttonChildren,
39
+ orientation: 'horizontal',
40
+ };
41
+ export const Orientation = {
42
+ render: (args) => (_jsxs(_Fragment, { children: [_jsx(ShowcaseItem, { title: "Horizontal", children: _jsx(ButtonGroup, Object.assign({}, args, { orientation: "horizontal", children: buttonChildren })) }), _jsx(ShowcaseItem, { title: "Vertical", children: _jsx(ButtonGroup, Object.assign({}, args, { orientation: "vertical", children: buttonChildren })) })] })),
43
+ decorators: defaultDecorators,
44
+ };
@@ -0,0 +1,8 @@
1
+ import './ButtonGroup.scss';
2
+ export type ButtonGroupProps = {
3
+ orientation?: 'horizontal' | 'vertical';
4
+ children: React.ReactNode;
5
+ className?: string;
6
+ qa?: string;
7
+ };
8
+ export declare const ButtonGroup: (props: ButtonGroupProps) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { block } from '../../../utils/cn';
3
+ import './ButtonGroup.scss';
4
+ const b = block('button-group');
5
+ export const ButtonGroup = (props) => {
6
+ const { orientation = 'horizontal', className, qa, children } = props;
7
+ return (_jsx("div", { className: b({ or: orientation }, className), "data-qa": qa, children: children }));
8
+ };
@@ -0,0 +1,39 @@
1
+ import { ReactNode } from 'react';
2
+ import './PromptInputBody.scss';
3
+ /**
4
+ * Props for the PromptInputBody component
5
+ */
6
+ export type PromptInputBodyProps = {
7
+ /** Value of the textarea */
8
+ value?: string;
9
+ /** Placeholder text */
10
+ placeholder?: string;
11
+ /** Maximum length of input */
12
+ maxLength?: number;
13
+ /** Minimum number of rows */
14
+ minRows?: number;
15
+ /** Maximum number of rows */
16
+ maxRows?: number;
17
+ /** Auto focus on mount */
18
+ autoFocus?: boolean;
19
+ /** Disabled state for input */
20
+ disabledInput?: boolean;
21
+ /** Change handler */
22
+ onChange?: (value: string) => void;
23
+ /** Key down handler */
24
+ onKeyDown?: (event: React.KeyboardEvent<HTMLTextAreaElement>) => void;
25
+ /** Custom content to replace the default textarea */
26
+ children?: ReactNode;
27
+ /** Additional CSS class */
28
+ className?: string;
29
+ /** QA/test identifier */
30
+ qa?: string;
31
+ };
32
+ /**
33
+ * PromptInputBody component displays the main input area
34
+ * with textarea or custom content
35
+ *
36
+ * @param props - Component props
37
+ * @returns React component
38
+ */
39
+ export declare const PromptInputBody: import("react").ForwardRefExoticComponent<PromptInputBodyProps & import("react").RefAttributes<HTMLTextAreaElement>>;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { forwardRef } from 'react';
3
+ import { TextArea } from '@gravity-ui/uikit';
4
+ import { block } from '../../../utils/cn';
5
+ import './PromptInputBody.scss';
6
+ const b = block('prompt-input-body');
7
+ /**
8
+ * PromptInputBody component displays the main input area
9
+ * with textarea or custom content
10
+ *
11
+ * @param props - Component props
12
+ * @returns React component
13
+ */
14
+ export const PromptInputBody = forwardRef((props, ref) => {
15
+ const { value, placeholder, maxLength, minRows = 1, maxRows = 15, autoFocus = false, disabledInput = false, onChange, onKeyDown, children, className, qa, } = props;
16
+ // If custom content is provided, render it
17
+ if (children) {
18
+ return (_jsx("div", { className: b(null, className), "data-qa": qa, children: children }));
19
+ }
20
+ // Render default textarea
21
+ return (_jsx("div", { className: b(null, className), "data-qa": qa, children: _jsx(TextArea, { controlRef: ref, size: "l", value: value, placeholder: placeholder, minRows: minRows, maxRows: maxRows, autoFocus: autoFocus, disabled: disabledInput, onUpdate: onChange, onKeyDown: onKeyDown, view: "clear", className: b('textarea'), controlProps: {
22
+ className: b('textarea-control'),
23
+ maxLength,
24
+ } }) }));
25
+ });
26
+ PromptInputBody.displayName = 'PromptInputBody';
@@ -0,0 +1,11 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { PromptInputBody } from '..';
3
+ declare const _default: Meta;
4
+ export default _default;
5
+ type Story = StoryObj<typeof PromptInputBody>;
6
+ export declare const Playground: Story;
7
+ export declare const WithValue: Story;
8
+ export declare const MultiLine: Story;
9
+ export declare const WithMaxLength: Story;
10
+ export declare const WithCustomContent: Story;
11
+ export declare const Disabled: Story;
@@ -0,0 +1,62 @@
1
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
2
+ import { useState } from 'react';
3
+ import { PromptInputBody } from '..';
4
+ import { ContentWrapper } from '../../../../demo/ContentWrapper';
5
+ import { SwapArea } from '../../../../demo/SwapArea';
6
+ import MDXDocs from './Docs.mdx';
7
+ export default {
8
+ title: 'molecules/PromptInputBody',
9
+ component: PromptInputBody,
10
+ parameters: {
11
+ docs: {
12
+ page: MDXDocs,
13
+ },
14
+ },
15
+ };
16
+ const defaultDecorators = [
17
+ (Story) => (_jsx(ContentWrapper, { width: "450px", children: _jsx(Story, {}) })),
18
+ ];
19
+ export const Playground = {
20
+ args: {
21
+ placeholder: 'Plan, code, build and test anything',
22
+ },
23
+ decorators: defaultDecorators,
24
+ };
25
+ export const WithValue = {
26
+ render: (args) => {
27
+ const [value, setValue] = useState('Hello, this is a test message!');
28
+ return (_jsx(PromptInputBody, Object.assign({}, args, { value: value, onChange: setValue, placeholder: "Plan, code, build and test anything" })));
29
+ },
30
+ decorators: defaultDecorators,
31
+ };
32
+ export const MultiLine = {
33
+ render: (args) => {
34
+ const [value, setValue] = useState('This is a multi-line\ntext input\nwith several lines\nof content');
35
+ return (_jsx(PromptInputBody, Object.assign({}, args, { value: value, onChange: setValue, placeholder: "Plan, code, build and test anything", minRows: 3, maxRows: 10 })));
36
+ },
37
+ decorators: defaultDecorators,
38
+ };
39
+ export const WithMaxLength = {
40
+ render: (args) => {
41
+ const [value, setValue] = useState('');
42
+ return (_jsxs(_Fragment, { children: [_jsx(PromptInputBody, Object.assign({}, args, { value: value, onChange: setValue, placeholder: "Maximum 100 characters", maxLength: 100 })), _jsxs("div", { style: {
43
+ marginTop: '8px',
44
+ fontSize: '12px',
45
+ color: 'var(--g-color-text-secondary)',
46
+ }, children: [value.length, " / 100 characters"] })] }));
47
+ },
48
+ decorators: defaultDecorators,
49
+ };
50
+ export const WithCustomContent = {
51
+ args: {
52
+ children: _jsx(SwapArea, {}),
53
+ },
54
+ decorators: defaultDecorators,
55
+ };
56
+ export const Disabled = {
57
+ render: (args) => {
58
+ const [value, setValue] = useState('This input is disabled');
59
+ return (_jsx(PromptInputBody, Object.assign({}, args, { value: value, onChange: setValue, placeholder: "Plan, code, build and test anything", disabledInput: true })));
60
+ },
61
+ decorators: defaultDecorators,
62
+ };
@@ -0,0 +1 @@
1
+ export { PromptInputBody, type PromptInputBodyProps } from './PromptInputBody';
@@ -0,0 +1 @@
1
+ export { PromptInputBody } from './PromptInputBody';
@@ -0,0 +1,39 @@
1
+ import { ReactNode } from 'react';
2
+ import type { ButtonButtonProps } from '@gravity-ui/uikit';
3
+ import { SubmitButtonProps } from '../../atoms/SubmitButton';
4
+ import './PromptInputFooter.scss';
5
+ /**
6
+ * Props for the PromptInputFooter component
7
+ */
8
+ export type PromptInputFooterProps = {
9
+ /** Submit button props */
10
+ submitButton: SubmitButtonProps;
11
+ /** Show settings icon */
12
+ showSettings?: boolean;
13
+ /** Settings icon click handler */
14
+ onSettingsClick?: () => void;
15
+ /** Show attachment icon */
16
+ showAttachment?: boolean;
17
+ /** Attachment icon click handler */
18
+ onAttachmentClick?: () => void;
19
+ /** Show microphone icon */
20
+ showMicrophone?: boolean;
21
+ /** Microphone icon click handler */
22
+ onMicrophoneClick?: () => void;
23
+ /** Custom content to replace the default footer (SubmitButton will still be rendered) */
24
+ children?: ReactNode;
25
+ /** Additional CSS class */
26
+ className?: string;
27
+ /** Button size */
28
+ buttonSize?: ButtonButtonProps['size'];
29
+ /** QA/test identifier */
30
+ qa?: string;
31
+ };
32
+ /**
33
+ * PromptInputFooter component displays the footer section with action icons
34
+ * and submit button
35
+ *
36
+ * @param props - Component props
37
+ * @returns React component
38
+ */
39
+ export declare function PromptInputFooter(props: PromptInputFooterProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,26 @@
1
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+ import { Microphone, Paperclip, Sliders } from '@gravity-ui/icons';
3
+ import { Icon } from '@gravity-ui/uikit';
4
+ import { block } from '../../../utils/cn';
5
+ import { ActionButton } from '../../atoms/ActionButton';
6
+ import { SubmitButton } from '../../atoms/SubmitButton';
7
+ import { ButtonGroup } from '../ButtonGroup';
8
+ import { i18n } from './i18n';
9
+ import './PromptInputFooter.scss';
10
+ const b = block('prompt-input-footer');
11
+ /**
12
+ * PromptInputFooter component displays the footer section with action icons
13
+ * and submit button
14
+ *
15
+ * @param props - Component props
16
+ * @returns React component
17
+ */
18
+ export function PromptInputFooter(props) {
19
+ const { submitButton, showSettings = false, onSettingsClick, showAttachment = false, onAttachmentClick, showMicrophone = false, onMicrophoneClick, children, className, buttonSize = 'm', qa, } = props;
20
+ // Render custom content with submit button
21
+ if (children) {
22
+ return (_jsxs("div", { className: b(null, className), "data-qa": qa, children: [_jsx("div", { className: b('content'), children: children }), _jsx("div", { className: b('submit'), children: _jsx(SubmitButton, Object.assign({}, submitButton, { size: buttonSize })) })] }));
23
+ }
24
+ // Render default footer
25
+ return (_jsxs("div", { className: b(null, className), "data-qa": qa, children: [_jsx(ButtonGroup, { children: showSettings && (_jsx(ActionButton, { view: "flat", size: buttonSize, onClick: onSettingsClick, className: b('action-button'), tooltipTitle: i18n('tooltip-settings'), children: _jsx(Icon, { data: Sliders, size: 16 }) })) }), _jsxs(ButtonGroup, { children: [showAttachment && (_jsx(ActionButton, { view: "flat", size: buttonSize, onClick: onAttachmentClick, className: b('action-button'), tooltipTitle: i18n('tooltip-attachment'), children: _jsx(Icon, { data: Paperclip, size: 16 }) })), showMicrophone && (_jsx(ActionButton, { view: "flat", size: buttonSize, onClick: onMicrophoneClick, className: b('action-button'), tooltipTitle: i18n('tooltip-microphone'), children: _jsx(Icon, { data: Microphone, size: 16 }) })), _jsx(SubmitButton, Object.assign({}, submitButton, { size: buttonSize }))] })] }));
26
+ }
@@ -0,0 +1,11 @@
1
+ import type { Meta, StoryObj } from '@storybook/react-webpack5';
2
+ import { PromptInputFooter } from '..';
3
+ declare const _default: Meta;
4
+ export default _default;
5
+ type Story = StoryObj<typeof PromptInputFooter>;
6
+ export declare const Playground: Story;
7
+ export declare const WithAllIcons: Story;
8
+ export declare const DisabledButton: Story;
9
+ export declare const LoadingButton: Story;
10
+ export declare const CancelableButton: Story;
11
+ export declare const WithCustomContent: Story;
@@ -0,0 +1,96 @@
1
+ import { jsx as _jsx } from "react/jsx-runtime";
2
+ import { PromptInputFooter } from '..';
3
+ import { ContentWrapper } from '../../../../demo/ContentWrapper';
4
+ import { SwapArea } from '../../../../demo/SwapArea';
5
+ import MDXDocs from './Docs.mdx';
6
+ export default {
7
+ title: 'molecules/PromptInputFooter',
8
+ component: PromptInputFooter,
9
+ parameters: {
10
+ docs: {
11
+ page: MDXDocs,
12
+ },
13
+ },
14
+ };
15
+ const defaultDecorators = [
16
+ (Story) => (_jsx(ContentWrapper, { width: "450px", children: _jsx(Story, {}) })),
17
+ ];
18
+ export const Playground = {
19
+ args: {
20
+ submitButton: {
21
+ // eslint-disable-next-line no-console
22
+ onClick: async () => console.log('Submit clicked'),
23
+ state: 'enabled',
24
+ },
25
+ },
26
+ decorators: defaultDecorators,
27
+ };
28
+ export const WithAllIcons = {
29
+ args: {
30
+ submitButton: {
31
+ // eslint-disable-next-line no-console
32
+ onClick: async () => console.log('Submit clicked'),
33
+ state: 'enabled',
34
+ },
35
+ showSettings: true,
36
+ showAttachment: true,
37
+ showMicrophone: true,
38
+ // eslint-disable-next-line no-console
39
+ onSettingsClick: () => console.log('Settings clicked'),
40
+ // eslint-disable-next-line no-console
41
+ onAttachmentClick: () => console.log('Attachment clicked'),
42
+ // eslint-disable-next-line no-console
43
+ onMicrophoneClick: () => console.log('Microphone clicked'),
44
+ },
45
+ decorators: defaultDecorators,
46
+ };
47
+ export const DisabledButton = {
48
+ args: {
49
+ submitButton: {
50
+ // eslint-disable-next-line no-console
51
+ onClick: async () => console.log('Submit clicked'),
52
+ state: 'disabled',
53
+ },
54
+ showSettings: true,
55
+ showAttachment: true,
56
+ showMicrophone: true,
57
+ },
58
+ decorators: defaultDecorators,
59
+ };
60
+ export const LoadingButton = {
61
+ args: {
62
+ submitButton: {
63
+ // eslint-disable-next-line no-console
64
+ onClick: async () => console.log('Submit clicked'),
65
+ state: 'loading',
66
+ },
67
+ showSettings: true,
68
+ showAttachment: true,
69
+ showMicrophone: true,
70
+ },
71
+ decorators: defaultDecorators,
72
+ };
73
+ export const CancelableButton = {
74
+ args: {
75
+ submitButton: {
76
+ // eslint-disable-next-line no-console
77
+ onClick: async () => console.log('Cancel clicked'),
78
+ state: 'cancelable',
79
+ },
80
+ showSettings: true,
81
+ showAttachment: true,
82
+ showMicrophone: true,
83
+ },
84
+ decorators: defaultDecorators,
85
+ };
86
+ export const WithCustomContent = {
87
+ args: {
88
+ submitButton: {
89
+ // eslint-disable-next-line no-console
90
+ onClick: async () => console.log('Submit clicked'),
91
+ state: 'enabled',
92
+ },
93
+ children: _jsx(SwapArea, {}),
94
+ },
95
+ decorators: defaultDecorators,
96
+ };
@@ -0,0 +1,5 @@
1
+ {
2
+ "tooltip-settings": "Settings",
3
+ "tooltip-attachment": "Attach file",
4
+ "tooltip-microphone": "Voice input"
5
+ }
@@ -0,0 +1,13 @@
1
+ export declare const i18n: ((key: "tooltip-settings" | "tooltip-attachment" | "tooltip-microphone", params?: import("@gravity-ui/i18n").Params) => string) & {
2
+ Translation: import("react").ComponentType<{
3
+ children: (props: {
4
+ t: (key: "tooltip-settings" | "tooltip-attachment" | "tooltip-microphone", params?: import("@gravity-ui/i18n").Params) => string;
5
+ }) => React.ReactNode;
6
+ }>;
7
+ useTranslation: () => {
8
+ t: (key: "tooltip-settings" | "tooltip-attachment" | "tooltip-microphone", params?: import("@gravity-ui/i18n").Params) => string;
9
+ };
10
+ keysetData: {
11
+ "g-aikit-PromptInputFooter": Record<"tooltip-settings" | "tooltip-attachment" | "tooltip-microphone", 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}PromptInputFooter`);
@@ -0,0 +1,5 @@
1
+ {
2
+ "tooltip-settings": "Настройки",
3
+ "tooltip-attachment": "Прикрепить файл",
4
+ "tooltip-microphone": "Голосовой ввод"
5
+ }
@@ -0,0 +1 @@
1
+ export { PromptInputFooter, type PromptInputFooterProps } from './PromptInputFooter';
@@ -0,0 +1 @@
1
+ export { PromptInputFooter } from './PromptInputFooter';