@forgedevstack/bear 1.3.2 → 1.3.3

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 (306) hide show
  1. package/README.md +4 -0
  2. package/dist/components/ApprovalCard/ApprovalCard.cjs +1 -0
  3. package/dist/components/ApprovalCard/ApprovalCard.const.cjs +1 -0
  4. package/dist/components/ApprovalCard/ApprovalCard.const.d.ts +2 -0
  5. package/dist/components/ApprovalCard/ApprovalCard.const.js +8 -0
  6. package/dist/components/ApprovalCard/ApprovalCard.d.ts +2 -0
  7. package/dist/components/ApprovalCard/ApprovalCard.js +25 -0
  8. package/dist/components/ApprovalCard/ApprovalCard.types.d.ts +15 -0
  9. package/dist/components/ApprovalCard/index.d.ts +2 -0
  10. package/dist/components/ArtifactCard/ArtifactCard.cjs +1 -0
  11. package/dist/components/ArtifactCard/ArtifactCard.const.cjs +1 -0
  12. package/dist/components/ArtifactCard/ArtifactCard.const.d.ts +3 -0
  13. package/dist/components/ArtifactCard/ArtifactCard.const.js +8 -0
  14. package/dist/components/ArtifactCard/ArtifactCard.d.ts +2 -0
  15. package/dist/components/ArtifactCard/ArtifactCard.js +43 -0
  16. package/dist/components/ArtifactCard/ArtifactCard.types.d.ts +15 -0
  17. package/dist/components/ArtifactCard/index.d.ts +2 -0
  18. package/dist/components/Banner/Banner.const.cjs +1 -1
  19. package/dist/components/Banner/Banner.const.js +9 -8
  20. package/dist/components/Chart/BarChart.cjs +1 -1
  21. package/dist/components/Chart/BarChart.js +65 -72
  22. package/dist/components/Chart/Chart.cjs +1 -1
  23. package/dist/components/Chart/Chart.js +21 -18
  24. package/dist/components/Chart/Chart.types.d.ts +1 -1
  25. package/dist/components/Chart/FunnelChart.cjs +1 -1
  26. package/dist/components/Chart/FunnelChart.js +38 -36
  27. package/dist/components/Chart/LineChart.cjs +1 -1
  28. package/dist/components/Chart/LineChart.js +74 -60
  29. package/dist/components/Chart/PieChart.cjs +1 -1
  30. package/dist/components/Chart/PieChart.js +102 -82
  31. package/dist/components/Chart/RadarChart.cjs +1 -1
  32. package/dist/components/Chart/RadarChart.d.ts +1 -1
  33. package/dist/components/Chart/RadarChart.js +116 -93
  34. package/dist/components/Chat/Chat.cjs +1 -1
  35. package/dist/components/Chat/Chat.const.cjs +1 -1
  36. package/dist/components/Chat/Chat.const.d.ts +9 -22
  37. package/dist/components/Chat/Chat.const.js +18 -26
  38. package/dist/components/Chat/Chat.d.ts +1 -20
  39. package/dist/components/Chat/Chat.js +107 -162
  40. package/dist/components/Chat/Chat.types.d.ts +20 -27
  41. package/dist/components/Chat/Chat.utils.cjs +1 -0
  42. package/dist/components/Chat/Chat.utils.d.ts +2 -0
  43. package/dist/components/Chat/Chat.utils.js +10 -0
  44. package/dist/components/Chat/helpers/ChatTypingIndicator.cjs +1 -0
  45. package/dist/components/Chat/helpers/ChatTypingIndicator.d.ts +3 -0
  46. package/dist/components/Chat/helpers/ChatTypingIndicator.js +14 -0
  47. package/dist/components/Chat/index.d.ts +2 -1
  48. package/dist/components/ChatBubble/ChatBubble.cjs +1 -0
  49. package/dist/components/ChatBubble/ChatBubble.const.cjs +1 -0
  50. package/dist/components/ChatBubble/ChatBubble.const.d.ts +13 -0
  51. package/dist/components/ChatBubble/ChatBubble.const.js +17 -0
  52. package/dist/components/ChatBubble/ChatBubble.d.ts +2 -0
  53. package/dist/components/ChatBubble/ChatBubble.js +32 -0
  54. package/dist/components/ChatBubble/ChatBubble.types.d.ts +12 -0
  55. package/dist/components/ChatBubble/ChatBubble.utils.cjs +1 -0
  56. package/dist/components/ChatBubble/ChatBubble.utils.d.ts +6 -0
  57. package/dist/components/ChatBubble/ChatBubble.utils.js +15 -0
  58. package/dist/components/ChatBubble/helpers/ChatBubbleSystem.cjs +1 -0
  59. package/dist/components/ChatBubble/helpers/ChatBubbleSystem.d.ts +2 -0
  60. package/dist/components/ChatBubble/helpers/ChatBubbleSystem.js +21 -0
  61. package/dist/components/ChatBubble/helpers/ChatBubbleThread.cjs +1 -0
  62. package/dist/components/ChatBubble/helpers/ChatBubbleThread.d.ts +4 -0
  63. package/dist/components/ChatBubble/helpers/ChatBubbleThread.js +63 -0
  64. package/dist/components/ChatBubble/index.d.ts +2 -0
  65. package/dist/components/ChatError/ChatError.cjs +1 -0
  66. package/dist/components/ChatError/ChatError.const.cjs +1 -0
  67. package/dist/components/ChatError/ChatError.const.d.ts +2 -0
  68. package/dist/components/ChatError/ChatError.const.js +8 -0
  69. package/dist/components/ChatError/ChatError.d.ts +2 -0
  70. package/dist/components/ChatError/ChatError.js +32 -0
  71. package/dist/components/ChatError/ChatError.types.d.ts +14 -0
  72. package/dist/components/ChatError/index.d.ts +2 -0
  73. package/dist/components/CitationList/CitationList.cjs +1 -0
  74. package/dist/components/CitationList/CitationList.d.ts +2 -0
  75. package/dist/components/CitationList/CitationList.js +30 -0
  76. package/dist/components/CitationList/CitationList.types.d.ts +15 -0
  77. package/dist/components/CitationList/helpers/CitationListTitle.cjs +1 -0
  78. package/dist/components/CitationList/helpers/CitationListTitle.d.ts +2 -0
  79. package/dist/components/CitationList/helpers/CitationListTitle.js +10 -0
  80. package/dist/components/CitationList/helpers/index.d.ts +1 -0
  81. package/dist/components/CitationList/index.d.ts +2 -0
  82. package/dist/components/ContextMeter/ContextMeter.cjs +1 -0
  83. package/dist/components/ContextMeter/ContextMeter.const.cjs +1 -0
  84. package/dist/components/ContextMeter/ContextMeter.const.d.ts +6 -0
  85. package/dist/components/ContextMeter/ContextMeter.const.js +11 -0
  86. package/dist/components/ContextMeter/ContextMeter.d.ts +2 -0
  87. package/dist/components/ContextMeter/ContextMeter.js +49 -0
  88. package/dist/components/ContextMeter/ContextMeter.types.d.ts +11 -0
  89. package/dist/components/ContextMeter/ContextMeter.utils.cjs +1 -0
  90. package/dist/components/ContextMeter/ContextMeter.utils.d.ts +2 -0
  91. package/dist/components/ContextMeter/ContextMeter.utils.js +12 -0
  92. package/dist/components/ContextMeter/index.d.ts +2 -0
  93. package/dist/components/Drawer/Drawer.cjs +1 -1
  94. package/dist/components/Drawer/Drawer.const.cjs +1 -1
  95. package/dist/components/Drawer/Drawer.const.d.ts +2 -1
  96. package/dist/components/Drawer/Drawer.const.js +7 -6
  97. package/dist/components/Drawer/Drawer.d.ts +1 -1
  98. package/dist/components/Drawer/Drawer.js +93 -83
  99. package/dist/components/Drawer/Drawer.types.d.ts +4 -1
  100. package/dist/components/Drawer/hooks/useDrawer.cjs +1 -1
  101. package/dist/components/Drawer/hooks/useDrawer.js +33 -34
  102. package/dist/components/Drawer/index.d.ts +1 -1
  103. package/dist/components/EmptyState/EmptyState.cjs +1 -1
  104. package/dist/components/EmptyState/EmptyState.const.cjs +1 -1
  105. package/dist/components/EmptyState/EmptyState.const.d.ts +8 -6
  106. package/dist/components/EmptyState/EmptyState.const.js +15 -8
  107. package/dist/components/EmptyState/EmptyState.d.ts +1 -2
  108. package/dist/components/EmptyState/EmptyState.js +39 -43
  109. package/dist/components/EmptyState/EmptyState.types.d.ts +2 -0
  110. package/dist/components/EmptyState/helpers/EmptyStateErrorSvg.cjs +1 -0
  111. package/dist/components/EmptyState/helpers/EmptyStateErrorSvg.d.ts +3 -0
  112. package/dist/components/EmptyState/helpers/EmptyStateErrorSvg.js +8 -0
  113. package/dist/components/EmptyState/helpers/EmptyStateInboxSvg.cjs +1 -0
  114. package/dist/components/EmptyState/helpers/EmptyStateInboxSvg.d.ts +3 -0
  115. package/dist/components/EmptyState/helpers/EmptyStateInboxSvg.js +8 -0
  116. package/dist/components/EmptyState/helpers/EmptyStateSearchSvg.cjs +1 -0
  117. package/dist/components/EmptyState/helpers/EmptyStateSearchSvg.d.ts +3 -0
  118. package/dist/components/EmptyState/helpers/EmptyStateSearchSvg.js +8 -0
  119. package/dist/components/EmptyState/helpers/index.d.ts +3 -0
  120. package/dist/components/EmptyState/index.d.ts +1 -1
  121. package/dist/components/FloatingChat/FloatingChat.cjs +1 -1
  122. package/dist/components/FloatingChat/FloatingChat.const.cjs +1 -1
  123. package/dist/components/FloatingChat/FloatingChat.const.d.ts +12 -1
  124. package/dist/components/FloatingChat/FloatingChat.const.js +25 -7
  125. package/dist/components/FloatingChat/FloatingChat.d.ts +1 -18
  126. package/dist/components/FloatingChat/FloatingChat.js +93 -124
  127. package/dist/components/FloatingChat/FloatingChat.types.d.ts +11 -22
  128. package/dist/components/FloatingChat/FloatingChat.utils.cjs +1 -0
  129. package/dist/components/FloatingChat/FloatingChat.utils.d.ts +2 -0
  130. package/dist/components/FloatingChat/FloatingChat.utils.js +12 -0
  131. package/dist/components/FloatingChat/helpers/FloatingChatHeader.cjs +1 -0
  132. package/dist/components/FloatingChat/helpers/FloatingChatHeader.d.ts +9 -0
  133. package/dist/components/FloatingChat/helpers/FloatingChatHeader.js +21 -0
  134. package/dist/components/FloatingChat/helpers/FloatingChatTrigger.cjs +1 -0
  135. package/dist/components/FloatingChat/helpers/FloatingChatTrigger.d.ts +9 -0
  136. package/dist/components/FloatingChat/helpers/FloatingChatTrigger.js +17 -0
  137. package/dist/components/FloatingChat/index.d.ts +1 -1
  138. package/dist/components/FormSkeleton/FormSkeleton.cjs +1 -1
  139. package/dist/components/FormSkeleton/FormSkeleton.d.ts +1 -1
  140. package/dist/components/FormSkeleton/FormSkeleton.js +35 -24
  141. package/dist/components/Icon/index.d.ts +1 -0
  142. package/dist/components/Icon/productIcons.cjs +1 -0
  143. package/dist/components/Icon/productIcons.d.ts +7 -0
  144. package/dist/components/Icon/productIcons.js +25 -0
  145. package/dist/components/MessageActions/MessageActions.cjs +1 -0
  146. package/dist/components/MessageActions/MessageActions.const.cjs +1 -0
  147. package/dist/components/MessageActions/MessageActions.const.d.ts +2 -0
  148. package/dist/components/MessageActions/MessageActions.const.js +10 -0
  149. package/dist/components/MessageActions/MessageActions.d.ts +2 -0
  150. package/dist/components/MessageActions/MessageActions.js +31 -0
  151. package/dist/components/MessageActions/MessageActions.types.d.ts +16 -0
  152. package/dist/components/MessageActions/index.d.ts +2 -0
  153. package/dist/components/Modal/Modal.cjs +1 -1
  154. package/dist/components/Modal/Modal.js +1 -1
  155. package/dist/components/ModelSelect/ModelSelect.cjs +1 -0
  156. package/dist/components/ModelSelect/ModelSelect.const.cjs +1 -0
  157. package/dist/components/ModelSelect/ModelSelect.const.d.ts +1 -0
  158. package/dist/components/ModelSelect/ModelSelect.const.js +4 -0
  159. package/dist/components/ModelSelect/ModelSelect.d.ts +2 -0
  160. package/dist/components/ModelSelect/ModelSelect.js +41 -0
  161. package/dist/components/ModelSelect/ModelSelect.types.d.ts +16 -0
  162. package/dist/components/ModelSelect/index.d.ts +2 -0
  163. package/dist/components/OverlayPortal/OverlayPortal.const.cjs +1 -1
  164. package/dist/components/OverlayPortal/OverlayPortal.const.js +6 -5
  165. package/dist/components/PasswordInput/PasswordInput.cjs +1 -1
  166. package/dist/components/PasswordInput/PasswordInput.js +5 -5
  167. package/dist/components/PromptComposer/PromptComposer.cjs +1 -0
  168. package/dist/components/PromptComposer/PromptComposer.const.cjs +1 -0
  169. package/dist/components/PromptComposer/PromptComposer.const.d.ts +6 -0
  170. package/dist/components/PromptComposer/PromptComposer.const.js +14 -0
  171. package/dist/components/PromptComposer/PromptComposer.d.ts +2 -0
  172. package/dist/components/PromptComposer/PromptComposer.js +132 -0
  173. package/dist/components/PromptComposer/PromptComposer.types.d.ts +45 -0
  174. package/dist/components/PromptComposer/PromptComposer.utils.cjs +1 -0
  175. package/dist/components/PromptComposer/PromptComposer.utils.d.ts +5 -0
  176. package/dist/components/PromptComposer/PromptComposer.utils.js +16 -0
  177. package/dist/components/PromptComposer/helpers/PromptComposerAttachSvg.cjs +1 -0
  178. package/dist/components/PromptComposer/helpers/PromptComposerAttachSvg.d.ts +1 -0
  179. package/dist/components/PromptComposer/helpers/PromptComposerAttachSvg.js +6 -0
  180. package/dist/components/PromptComposer/helpers/PromptComposerFileChip.cjs +1 -0
  181. package/dist/components/PromptComposer/helpers/PromptComposerFileChip.d.ts +2 -0
  182. package/dist/components/PromptComposer/helpers/PromptComposerFileChip.js +18 -0
  183. package/dist/components/PromptComposer/helpers/PromptComposerSendSvg.cjs +1 -0
  184. package/dist/components/PromptComposer/helpers/PromptComposerSendSvg.d.ts +1 -0
  185. package/dist/components/PromptComposer/helpers/PromptComposerSendSvg.js +9 -0
  186. package/dist/components/PromptComposer/helpers/PromptComposerStopSvg.cjs +1 -0
  187. package/dist/components/PromptComposer/helpers/PromptComposerStopSvg.d.ts +1 -0
  188. package/dist/components/PromptComposer/helpers/PromptComposerStopSvg.js +6 -0
  189. package/dist/components/PromptComposer/helpers/index.d.ts +4 -0
  190. package/dist/components/PromptComposer/index.d.ts +2 -0
  191. package/dist/components/PromptSuggestions/PromptSuggestions.cjs +1 -0
  192. package/dist/components/PromptSuggestions/PromptSuggestions.d.ts +2 -0
  193. package/dist/components/PromptSuggestions/PromptSuggestions.js +39 -0
  194. package/dist/components/PromptSuggestions/PromptSuggestions.types.d.ts +13 -0
  195. package/dist/components/PromptSuggestions/index.d.ts +2 -0
  196. package/dist/components/RichEditor/helpers/IconRender.cjs +1 -1
  197. package/dist/components/RichEditor/helpers/IconRender.js +16 -16
  198. package/dist/components/RichEditor/helpers/toolbarItemRender.cjs +1 -1
  199. package/dist/components/RichEditor/helpers/toolbarItemRender.js +23 -23
  200. package/dist/components/Select/Select.cjs +1 -1
  201. package/dist/components/Select/Select.js +23 -23
  202. package/dist/components/Select/helpers/SelectCheckSvg.cjs +1 -0
  203. package/dist/components/Select/helpers/SelectCheckSvg.d.ts +3 -0
  204. package/dist/components/Select/helpers/SelectCheckSvg.js +8 -0
  205. package/dist/components/Select/helpers/SelectChevronDownSvg.cjs +1 -0
  206. package/dist/components/Select/helpers/SelectChevronDownSvg.d.ts +3 -0
  207. package/dist/components/Select/helpers/SelectChevronDownSvg.js +8 -0
  208. package/dist/components/Select/helpers/index.d.ts +2 -0
  209. package/dist/components/Skeleton/Skeleton.cjs +1 -1
  210. package/dist/components/Skeleton/Skeleton.const.cjs +2 -2
  211. package/dist/components/Skeleton/Skeleton.const.js +5 -6
  212. package/dist/components/Skeleton/Skeleton.js +59 -59
  213. package/dist/components/StatCard/StatCard.cjs +1 -1
  214. package/dist/components/StatCard/StatCard.const.cjs +1 -1
  215. package/dist/components/StatCard/StatCard.const.d.ts +0 -7
  216. package/dist/components/StatCard/StatCard.const.js +5 -12
  217. package/dist/components/StatCard/StatCard.d.ts +1 -2
  218. package/dist/components/StatCard/StatCard.js +48 -37
  219. package/dist/components/StatCard/StatCard.utils.cjs +1 -0
  220. package/dist/components/StatCard/StatCard.utils.d.ts +2 -0
  221. package/dist/components/StatCard/StatCard.utils.js +7 -0
  222. package/dist/components/StreamingMessage/StreamingMessage.cjs +1 -0
  223. package/dist/components/StreamingMessage/StreamingMessage.const.cjs +1 -0
  224. package/dist/components/StreamingMessage/StreamingMessage.const.d.ts +5 -0
  225. package/dist/components/StreamingMessage/StreamingMessage.const.js +10 -0
  226. package/dist/components/StreamingMessage/StreamingMessage.d.ts +2 -0
  227. package/dist/components/StreamingMessage/StreamingMessage.js +48 -0
  228. package/dist/components/StreamingMessage/StreamingMessage.types.d.ts +15 -0
  229. package/dist/components/StreamingMessage/index.d.ts +2 -0
  230. package/dist/components/ThemeSwitcher/ThemeSwitcher.cjs +1 -0
  231. package/dist/components/ThemeSwitcher/ThemeSwitcher.const.cjs +1 -0
  232. package/dist/components/ThemeSwitcher/ThemeSwitcher.const.d.ts +7 -0
  233. package/dist/components/ThemeSwitcher/ThemeSwitcher.const.js +14 -0
  234. package/dist/components/ThemeSwitcher/ThemeSwitcher.d.ts +2 -0
  235. package/dist/components/ThemeSwitcher/ThemeSwitcher.js +39 -0
  236. package/dist/components/ThemeSwitcher/ThemeSwitcher.types.d.ts +14 -0
  237. package/dist/components/ThemeSwitcher/index.d.ts +2 -0
  238. package/dist/components/ThinkingBlock/ThinkingBlock.cjs +1 -0
  239. package/dist/components/ThinkingBlock/ThinkingBlock.const.cjs +1 -0
  240. package/dist/components/ThinkingBlock/ThinkingBlock.const.d.ts +4 -0
  241. package/dist/components/ThinkingBlock/ThinkingBlock.const.js +9 -0
  242. package/dist/components/ThinkingBlock/ThinkingBlock.d.ts +2 -0
  243. package/dist/components/ThinkingBlock/ThinkingBlock.js +45 -0
  244. package/dist/components/ThinkingBlock/ThinkingBlock.types.d.ts +16 -0
  245. package/dist/components/ThinkingBlock/index.d.ts +2 -0
  246. package/dist/components/ToolCall/ToolCall.cjs +1 -0
  247. package/dist/components/ToolCall/ToolCall.const.cjs +1 -0
  248. package/dist/components/ToolCall/ToolCall.const.d.ts +5 -0
  249. package/dist/components/ToolCall/ToolCall.const.js +17 -0
  250. package/dist/components/ToolCall/ToolCall.d.ts +2 -0
  251. package/dist/components/ToolCall/ToolCall.js +43 -0
  252. package/dist/components/ToolCall/ToolCall.types.d.ts +20 -0
  253. package/dist/components/ToolCall/index.d.ts +2 -0
  254. package/dist/components/Transition/Transition.const.cjs +1 -1
  255. package/dist/components/Transition/Transition.const.js +12 -6
  256. package/dist/components/Transition/Transition.types.d.ts +1 -1
  257. package/dist/components/index.cjs +1 -1
  258. package/dist/components/index.d.ts +37 -9
  259. package/dist/components/index.js +455 -423
  260. package/dist/constants/generals.const.cjs +1 -1
  261. package/dist/constants/generals.const.d.ts +46 -0
  262. package/dist/constants/generals.const.js +158 -115
  263. package/dist/constants/keys.const.cjs +1 -1
  264. package/dist/constants/keys.const.js +2 -1
  265. package/dist/constants/numbers.const.cjs +1 -1
  266. package/dist/constants/numbers.const.d.ts +7 -0
  267. package/dist/constants/numbers.const.js +60 -52
  268. package/dist/context/BearProvider.cjs +1 -1
  269. package/dist/context/BearProvider.d.ts +19 -44
  270. package/dist/context/BearProvider.js +223 -208
  271. package/dist/context/bearProvider.types.d.ts +4 -0
  272. package/dist/context/index.d.ts +1 -1
  273. package/dist/hooks/useFixedAnchorPosition/index.d.ts +1 -1
  274. package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.cjs +1 -1
  275. package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.d.ts +2 -1
  276. package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.js +12 -11
  277. package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.types.d.ts +1 -1
  278. package/dist/index.cjs +1 -1
  279. package/dist/index.js +595 -563
  280. package/dist/styles/_ai-chat.css +487 -0
  281. package/dist/styles/_base.css +2 -0
  282. package/dist/styles/_chart.css +144 -0
  283. package/dist/styles/_effects.css +8 -4
  284. package/dist/styles/_skeleton.css +90 -0
  285. package/dist/styles/main.css +3 -0
  286. package/dist/styles.css +734 -32
  287. package/package.json +1 -1
  288. package/dist/components/FormSkeleton/FormSkeleton.const.cjs +0 -1
  289. package/dist/components/FormSkeleton/FormSkeleton.const.d.ts +0 -5
  290. package/dist/components/FormSkeleton/FormSkeleton.const.js +0 -8
  291. package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.cjs +0 -1
  292. package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.const.cjs +0 -1
  293. package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.const.js +0 -14
  294. package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.js +0 -35
  295. package/dist/node_modules/@forgedevstack/bear-icons/dist/action.cjs +0 -1
  296. package/dist/node_modules/@forgedevstack/bear-icons/dist/action.js +0 -26
  297. package/dist/node_modules/@forgedevstack/bear-icons/dist/cn.utils.cjs +0 -1
  298. package/dist/node_modules/@forgedevstack/bear-icons/dist/cn.utils.js +0 -4
  299. package/dist/node_modules/@forgedevstack/bear-icons/dist/editor.cjs +0 -1
  300. package/dist/node_modules/@forgedevstack/bear-icons/dist/editor.js +0 -130
  301. package/dist/node_modules/@forgedevstack/bear-icons/dist/misc.cjs +0 -1
  302. package/dist/node_modules/@forgedevstack/bear-icons/dist/misc.js +0 -12
  303. package/dist/node_modules/@forgedevstack/bear-icons/dist/navigation.cjs +0 -1
  304. package/dist/node_modules/@forgedevstack/bear-icons/dist/navigation.js +0 -18
  305. package/dist/node_modules/@forgedevstack/bear-icons/dist/status.cjs +0 -1
  306. package/dist/node_modules/@forgedevstack/bear-icons/dist/status.js +0 -6
@@ -1,100 +1,123 @@
1
- import { jsx as n, jsxs as T } from "react/jsx-runtime";
2
- import { ZERO as A, ONE as d } from "../../constants/numbers.const.js";
3
- import { cn as u } from "../../utils/cn.js";
1
+ import { jsx as s, jsxs as y } from "react/jsx-runtime";
2
+ import { ZERO as m, ONE as f } from "../../constants/numbers.const.js";
3
+ import { cn as A } from "../../utils/cn.js";
4
4
  import "react";
5
- import { CHART as r } from "./Chart.const.js";
6
- import { polarToCartesian as c, getChartColor as R } from "./Chart.utils.js";
7
- const $ = (_) => {
5
+ import { resolveBearId as O } from "../../utils/generateBearId.utils.js";
6
+ import { useBearId as $ } from "../../utils/useBearId.js";
7
+ import { CHART as a } from "./Chart.const.js";
8
+ import { polarToCartesian as i, getChartColor as R } from "./Chart.utils.js";
9
+ const P = (g) => {
8
10
  const {
9
- data: o,
10
- height: f = r.DEFAULT_HEIGHT,
11
- showLabels: p = !0,
12
- showValues: h = !1,
13
- animated: b = !0,
14
- color: i,
15
- className: x,
16
- ...y
17
- } = _, m = o.length;
18
- if (m === A)
19
- return null;
20
- const g = Math.max(...o.map((e) => e.value), d), s = r.FULL_SWEEP / m, E = o.map((e, a) => {
21
- const t = r.DEFAULT_START_ANGLE + a * s, l = e.value / g * r.OUTER_RADIUS;
22
- return c(t, l);
23
- }), S = E.map((e) => `${e.x},${e.y}`).join(" "), U = Array.from({ length: r.RADAR_RINGS }, (e, a) => {
24
- const t = (a + d) / r.RADAR_RINGS * r.OUTER_RADIUS;
25
- return Array.from({ length: m }, (l, D) => {
26
- const L = r.DEFAULT_START_ANGLE + D * s;
27
- return c(L, t);
28
- });
29
- });
30
- return /* @__PURE__ */ n("div", { className: u("Bear-Chart Bear-Chart--radar bear-flex bear-flex-col bear-items-center", x), style: { height: f }, ...y, children: /* @__PURE__ */ T("svg", { viewBox: `0 0 ${r.VIEWBOX} ${r.VIEWBOX}`, className: "bear-h-full bear-w-full", children: [
31
- U.map((e, a) => /* @__PURE__ */ n(
32
- "polygon",
33
- {
34
- points: e.map((t) => `${t.x},${t.y}`).join(" "),
35
- fill: "none",
36
- stroke: "var(--bear-border-default, #e5e5e5)",
37
- strokeWidth: 0.4
38
- },
39
- a
40
- )),
41
- o.map((e, a) => {
42
- const t = r.DEFAULT_START_ANGLE + a * s, l = c(t, r.OUTER_RADIUS);
43
- return /* @__PURE__ */ n(
44
- "line",
45
- {
46
- x1: r.CENTER,
47
- y1: r.CENTER,
48
- x2: l.x,
49
- y2: l.y,
50
- stroke: "var(--bear-border-default, #e5e5e5)",
51
- strokeWidth: 0.4
52
- },
53
- e.label
54
- );
55
- }),
56
- /* @__PURE__ */ n(
57
- "polygon",
11
+ data: l,
12
+ height: x = a.DEFAULT_HEIGHT,
13
+ showLabels: S = !0,
14
+ showValues: C = !1,
15
+ animated: I = !0,
16
+ color: c,
17
+ className: h,
18
+ id: N,
19
+ testId: E,
20
+ ...p
21
+ } = g, U = $("RadarChart"), T = O(N, U), d = l.length, _ = { "--Bear-Chart-height": `${x}px` };
22
+ if (d === m)
23
+ return /* @__PURE__ */ s(
24
+ "div",
58
25
  {
59
- points: S,
60
- fill: R(A, i),
61
- fillOpacity: 0.25,
62
- stroke: R(A, i),
63
- strokeWidth: 0.8,
64
- className: u(b && "animate-scale-in")
26
+ id: T,
27
+ "data-testid": E,
28
+ className: A("Bear-Chart Bear-Chart--radar Bear-Chart--empty", h),
29
+ style: _,
30
+ ...p
65
31
  }
66
- ),
67
- E.map((e, a) => /* @__PURE__ */ n(
68
- "circle",
69
- {
70
- cx: e.x,
71
- cy: e.y,
72
- r: r.DOT_RADIUS,
73
- fill: R(a, o[a].color || i)
74
- },
75
- o[a].label
76
- )),
77
- p && o.map((e, a) => {
78
- const t = r.DEFAULT_START_ANGLE + a * s, l = c(t, r.OUTER_RADIUS + r.RADAR_LABEL_OFFSET);
79
- return /* @__PURE__ */ T(
80
- "text",
81
- {
82
- x: l.x,
83
- y: l.y,
84
- textAnchor: "middle",
85
- dominantBaseline: "middle",
86
- className: "bear-fill-[var(--bear-text-secondary)]",
87
- fontSize: 4,
88
- children: [
89
- e.label,
90
- h ? ` ${e.value}` : ""
91
- ]
92
- },
93
- `${e.label}-label`
94
- );
95
- })
96
- ] }) });
32
+ );
33
+ const B = Math.max(...l.map((e) => e.value), f), n = a.FULL_SWEEP / d, u = l.map((e, r) => {
34
+ const t = a.DEFAULT_START_ANGLE + r * n, o = e.value / B * a.OUTER_RADIUS;
35
+ return i(t, o);
36
+ }), D = u.map((e) => `${e.x},${e.y}`).join(" "), L = Array.from({ length: a.RADAR_RINGS }, (e, r) => {
37
+ const t = (r + f) / a.RADAR_RINGS * a.OUTER_RADIUS;
38
+ return Array.from({ length: d }, (o, b) => {
39
+ const v = a.DEFAULT_START_ANGLE + b * n;
40
+ return i(v, t);
41
+ });
42
+ });
43
+ return /* @__PURE__ */ s(
44
+ "div",
45
+ {
46
+ id: T,
47
+ "data-testid": E,
48
+ className: A("Bear-Chart Bear-Chart--radar", h),
49
+ style: _,
50
+ ...p,
51
+ children: /* @__PURE__ */ y("svg", { viewBox: `0 0 ${a.VIEWBOX} ${a.VIEWBOX}`, className: "Bear-Chart__svg", children: [
52
+ L.map((e, r) => /* @__PURE__ */ s(
53
+ "polygon",
54
+ {
55
+ points: e.map((t) => `${t.x},${t.y}`).join(" "),
56
+ fill: "none",
57
+ stroke: "var(--bear-border-default, #e5e5e5)",
58
+ strokeWidth: 0.4
59
+ },
60
+ r
61
+ )),
62
+ l.map((e, r) => {
63
+ const t = a.DEFAULT_START_ANGLE + r * n, o = i(t, a.OUTER_RADIUS);
64
+ return /* @__PURE__ */ s(
65
+ "line",
66
+ {
67
+ x1: a.CENTER,
68
+ y1: a.CENTER,
69
+ x2: o.x,
70
+ y2: o.y,
71
+ stroke: "var(--bear-border-default, #e5e5e5)",
72
+ strokeWidth: 0.4
73
+ },
74
+ e.label
75
+ );
76
+ }),
77
+ /* @__PURE__ */ s(
78
+ "polygon",
79
+ {
80
+ points: D,
81
+ fill: R(m, c),
82
+ fillOpacity: 0.25,
83
+ stroke: R(m, c),
84
+ strokeWidth: 0.8,
85
+ className: A(I && "animate-scale-in")
86
+ }
87
+ ),
88
+ u.map((e, r) => /* @__PURE__ */ s(
89
+ "circle",
90
+ {
91
+ cx: e.x,
92
+ cy: e.y,
93
+ r: a.DOT_RADIUS,
94
+ fill: R(r, l[r].color || c)
95
+ },
96
+ l[r].label
97
+ )),
98
+ S && l.map((e, r) => {
99
+ const t = a.DEFAULT_START_ANGLE + r * n, o = i(t, a.OUTER_RADIUS + a.RADAR_LABEL_OFFSET);
100
+ return /* @__PURE__ */ y(
101
+ "text",
102
+ {
103
+ x: o.x,
104
+ y: o.y,
105
+ textAnchor: "middle",
106
+ dominantBaseline: "middle",
107
+ className: "bear-fill-[var(--bear-text-secondary)]",
108
+ fontSize: 4,
109
+ children: [
110
+ e.label,
111
+ C ? ` ${e.value}` : ""
112
+ ]
113
+ },
114
+ `${e.label}-label`
115
+ );
116
+ })
117
+ ] })
118
+ }
119
+ );
97
120
  };
98
121
  export {
99
- $ as RadarChart
122
+ P as RadarChart
100
123
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),i=require("react"),d=require("../../utils/cn.cjs"),D=require("../../context/BearProvider.cjs"),I=require("../Button/Button.cjs"),q=require("../Input/Input.cjs"),B=require("../Avatar/Avatar.cjs");require("../Box/Box.cjs");const u=require("../Typography/Typography.cjs"),_=require("@forgedevstack/bear-icons"),x=require("./Chat.const.cjs"),R=({message:r,showTimestamp:n=!0,showStatus:s=!0,showAvatar:b=!0,userAvatar:y,botAvatar:m})=>{var c;const a=r.sender==="user",f=r.sender==="system",l=x.SENDER_COLORS[r.sender];if(f)return e.jsx("div",{className:"flex justify-center my-2",children:e.jsx(u.Typography,{variant:"caption",className:"px-3 py-1 rounded-full bg-gray-100 dark:bg-gray-800",style:{color:l.text},children:r.content})});const v=a?y:m,p=r.status?x.MESSAGE_STATUS_ICONS[r.status]:null;return e.jsxs("div",{className:d.cn("flex gap-2 mb-3",a?"flex-row-reverse":"flex-row"),children:[b&&e.jsx(B.Avatar,{src:v,initials:((c=r.name)==null?void 0:c[0])||(a?"U":"B"),size:"sm",className:"flex-shrink-0"}),e.jsxs("div",{className:d.cn("flex flex-col max-w-[70%]",a?"items-end":"items-start"),children:[r.name&&e.jsx(u.Typography,{variant:"caption",className:"mb-1 opacity-60",children:r.name}),e.jsx("div",{className:d.cn("px-4 py-2 rounded-2xl",a?"rounded-br-sm":"rounded-bl-sm"),style:{backgroundColor:l.bg,color:l.text},children:typeof r.content=="string"?e.jsx(u.Typography,{variant:"body2",children:r.content}):r.content}),e.jsxs("div",{className:"flex items-center gap-1 mt-1",children:[n&&r.timestamp&&e.jsx(u.Typography,{variant:"caption",className:"opacity-50 text-xs",children:r.timestamp.toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"})}),s&&p&&a&&e.jsx("span",{className:d.cn("text-xs",r.status==="read"?"text-blue-500":"opacity-50",r.status==="error"&&"text-red-500"),children:p})]})]})]})},H=({text:r=x.CHAT_DEFAULTS.TYPING_TEXT})=>e.jsxs("div",{className:"flex items-center gap-2 mb-3",children:[e.jsxs("div",{className:"flex gap-1 px-4 py-3 bg-gray-100 dark:bg-gray-800 rounded-2xl rounded-bl-sm",children:[e.jsx("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"0ms"}}),e.jsx("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"150ms"}}),e.jsx("span",{className:"w-2 h-2 bg-gray-400 rounded-full animate-bounce",style:{animationDelay:"300ms"}})]}),e.jsx(u.Typography,{variant:"caption",className:"opacity-50",children:r})]}),U=({messages:r,onSend:n,isLoading:s=!1,placeholder:b=x.CHAT_DEFAULTS.PLACEHOLDER,header:y,footer:m,showTimestamps:a=!0,showStatus:f=!0,showAvatars:l=!0,userAvatar:v,botAvatar:p,isTyping:c=!1,typingText:C,className:S,height:j=x.CHAT_DEFAULTS.HEIGHT,testId:w,disabled:h=!1})=>{const{mode:E}=D.useBear(),k=E==="dark",[o,g]=i.useState(""),T=i.useRef(null);i.useEffect(()=>{var t;(t=T.current)==null||t.scrollIntoView({behavior:"smooth"})},[r,c]);const N=i.useCallback(()=>{o.trim()&&n&&!h&&!s&&(n(o.trim()),g(""))},[o,n,h,s]),A=i.useCallback(t=>{t.key==="Enter"&&!t.shiftKey&&(t.preventDefault(),N())},[N]);return e.jsxs("div",{className:d.cn("Bear-Chat","flex flex-col rounded-xl overflow-hidden border",k?"bg-gray-900 border-gray-700":"bg-white border-gray-200",S),style:{height:typeof j=="number"?`${j}px`:j},"data-testid":w,children:[y&&e.jsx("div",{className:"px-4 py-3 border-b border-gray-200 dark:border-gray-700",children:y}),e.jsxs("div",{className:"flex-1 overflow-y-auto p-4",children:[r.map(t=>e.jsx(R,{message:t,showTimestamp:a,showStatus:f,showAvatar:l,userAvatar:v,botAvatar:p},t.id)),c&&e.jsx(H,{text:C}),e.jsx("div",{ref:T})]}),e.jsxs("div",{className:"p-3 border-t border-gray-200 dark:border-gray-700",children:[e.jsxs("div",{className:"flex gap-2",children:[e.jsx(q.Input,{value:o,onChange:t=>g(t.target.value),onKeyDown:A,placeholder:b,disabled:h||s,className:"flex-1"}),e.jsx(I.Button,{variant:"primary",onClick:N,disabled:!o.trim()||h||s,children:e.jsx(_.BearIcons.SendIcon,{size:18})})]}),m&&e.jsx("div",{className:"mt-2",children:m})]})]})};exports.Chat=U;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),a=require("react"),r=require("../../constants/generals.const.cjs"),Z=require("../../utils/cn.cjs"),$=require("../../utils/generateBearId.utils.cjs"),ee=require("../../utils/useBearId.cjs"),te=require("../../utils/liveRegion.utils.cjs"),o=require("../Box/Box.cjs"),se=require("../Button/Button.cjs"),re=require("../ChatBubble/ChatBubble.cjs"),oe=require("../ChatError/ChatError.cjs"),ne=require("../PromptComposer/PromptComposer.cjs"),ae=require("../PromptSuggestions/PromptSuggestions.cjs"),n=require("./Chat.const.cjs"),S=require("./Chat.utils.cjs"),ce=require("./helpers/ChatTypingIndicator.cjs"),ie=E=>{const{id:C,testId:p,messages:c,onSend:L,onStop:O,onAttach:x,isLoading:N=r.BOOLEAN_FALSE,isStreaming:f=r.BOOLEAN_FALSE,isTyping:R=r.BOOLEAN_FALSE,placeholder:q,header:T,footer:H,showTimestamps:I=n.CHAT_DEFAULT_SHOW_TIMESTAMPS,showStatus:j=n.CHAT_DEFAULT_SHOW_STATUS,showAvatars:v=n.CHAT_DEFAULT_SHOW_AVATARS,userAvatar:F,botAvatar:b,typingText:y,className:w,height:U=n.CHAT_DEFAULTS.HEIGHT,disabled:P=n.CHAT_DEFAULT_DISABLED,allowAttach:D,suggestions:l,onSuggestionSelect:M,errorTitle:W,errorMessage:g,onRetry:V,translations:k}=E,z=ee.useBearId(r.COMPONENT_NAME_CHAT),G=$.resolveBearId(C,z),u=a.useRef(null),h=a.useRef(r.BOOLEAN_TRUE),A=a.useRef(null),[J,d]=a.useState(r.BOOLEAN_FALSE),_={...n.CHAT_DEFAULT_TRANSLATIONS,...k},B=f||N,s=c[c.length-1],K=B&&typeof(s==null?void 0:s.content)=="string"?s.content:void 0,Q=te.getBearLiveRegionProps("info"),m=()=>{const e=u.current;e&&(e.scrollTop=e.scrollHeight,h.current=r.BOOLEAN_TRUE,d(r.BOOLEAN_FALSE))},X=()=>{const e=u.current;if(!e)return;const i=S.isChatScrollerAtBottom(e);h.current=i,i&&d(r.BOOLEAN_FALSE)};return a.useEffect(()=>{const e=(s==null?void 0:s.id)??null,i=A.current===null,Y=e!==null&&e!==A.current;if(A.current=e,!!Y){if(i||h.current){m();return}d(r.BOOLEAN_TRUE)}},[c,s==null?void 0:s.id]),t.jsxs(o.Box,{id:G,"data-testid":p,className:Z.cn("Bear-Chat",w),style:S.resolveChatHeightVar(U),children:[T&&t.jsx(o.Box,{className:"Bear-Chat__header",children:T}),t.jsxs(o.Box,{ref:u,className:"Bear-Chat__messages",onScroll:X,children:[t.jsx(o.Box,{className:"Bear-Chat__live",...Q,children:K}),c.map(e=>t.jsx(re.ChatBubble,{message:e,showTimestamp:I,showStatus:j,showAvatar:v,userAvatar:F,botAvatar:b},e.id)),R&&!B&&t.jsx(ce.ChatTypingIndicator,{text:y??_.typingText}),g&&t.jsx(oe.ChatError,{title:W,onRetry:V,children:g}),J&&t.jsx(se.Button,{type:"button",variant:"primary",size:"sm",className:"Bear-Chat__new-messages",onClick:m,children:_.newMessagesLabel})]}),l&&l.length>0&&t.jsx(o.Box,{className:"Bear-Chat__suggestions",children:t.jsx(ae.PromptSuggestions,{suggestions:l,onSelect:M})}),t.jsxs(o.Box,{className:"Bear-Chat__composer",children:[t.jsx(ne.PromptComposer,{onSubmit:L,onStop:O,onAttach:x,isStreaming:B,disabled:P,allowAttach:D,placeholder:q??_.placeholder}),H]})]})};exports.Chat=ie;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e={PLACEHOLDER:"Type a message...",HEIGHT:400,TYPING_TEXT:"is typing..."},t={sending:"○",sent:"✓",delivered:"✓✓",read:"✓✓",error:"!"},r={user:{bg:"var(--bear-primary-500)",text:"white"},bot:{bg:"var(--bear-bg-secondary)",text:"var(--bear-text-primary)"},system:{bg:"transparent",text:"var(--bear-text-tertiary, var(--bear-text-muted))"}};exports.CHAT_DEFAULTS=e;exports.MESSAGE_STATUS_ICONS=t;exports.SENDER_COLORS=r;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const _=require("../../constants/numbers.const.cjs"),T=require("../../constants/generals.const.cjs"),A={PLACEHOLDER:T.PLACEHOLDER_START_TYPING,HEIGHT:_.FOUR_HUNDRED,TYPING_TEXT:"is typing..."},E={placeholder:A.PLACEHOLDER,typingText:A.TYPING_TEXT,newMessagesLabel:T.LABEL_NEW_MESSAGES},H=_.CHAT_STICK_THRESHOLD_PX,S=T.BOOLEAN_TRUE,L=T.BOOLEAN_TRUE,C=T.BOOLEAN_TRUE,D=T.BOOLEAN_FALSE,O="--Bear-Chat-height";exports.CHAT_DEFAULTS=A;exports.CHAT_DEFAULT_DISABLED=D;exports.CHAT_DEFAULT_SHOW_AVATARS=C;exports.CHAT_DEFAULT_SHOW_STATUS=L;exports.CHAT_DEFAULT_SHOW_TIMESTAMPS=S;exports.CHAT_DEFAULT_TRANSLATIONS=E;exports.CHAT_HEIGHT_VAR=O;exports.CHAT_STICK_THRESHOLD=H;
@@ -1,26 +1,13 @@
1
+ import { ChatTranslations } from './Chat.types';
1
2
  export declare const CHAT_DEFAULTS: {
2
- readonly PLACEHOLDER: "Type a message...";
3
+ readonly PLACEHOLDER: "Start typing...";
3
4
  readonly HEIGHT: 400;
4
5
  readonly TYPING_TEXT: "is typing...";
5
6
  };
6
- export declare const MESSAGE_STATUS_ICONS: {
7
- readonly sending: "○";
8
- readonly sent: "✓";
9
- readonly delivered: "✓✓";
10
- readonly read: "✓✓";
11
- readonly error: "!";
12
- };
13
- export declare const SENDER_COLORS: {
14
- readonly user: {
15
- readonly bg: "var(--bear-primary-500)";
16
- readonly text: "white";
17
- };
18
- readonly bot: {
19
- readonly bg: "var(--bear-bg-secondary)";
20
- readonly text: "var(--bear-text-primary)";
21
- };
22
- readonly system: {
23
- readonly bg: "transparent";
24
- readonly text: "var(--bear-text-tertiary, var(--bear-text-muted))";
25
- };
26
- };
7
+ export declare const CHAT_DEFAULT_TRANSLATIONS: ChatTranslations;
8
+ export declare const CHAT_STICK_THRESHOLD = 16;
9
+ export declare const CHAT_DEFAULT_SHOW_TIMESTAMPS = true;
10
+ export declare const CHAT_DEFAULT_SHOW_STATUS = true;
11
+ export declare const CHAT_DEFAULT_SHOW_AVATARS = true;
12
+ export declare const CHAT_DEFAULT_DISABLED = false;
13
+ export declare const CHAT_HEIGHT_VAR = "--Bear-Chat-height";
@@ -1,29 +1,21 @@
1
- const e = {
2
- PLACEHOLDER: "Type a message...",
3
- HEIGHT: 400,
1
+ import { FOUR_HUNDRED as _, CHAT_STICK_THRESHOLD_PX as E } from "../../constants/numbers.const.js";
2
+ import { BOOLEAN_TRUE as T, BOOLEAN_FALSE as H, LABEL_NEW_MESSAGES as L, PLACEHOLDER_START_TYPING as S } from "../../constants/generals.const.js";
3
+ const A = {
4
+ PLACEHOLDER: S,
5
+ HEIGHT: _,
4
6
  TYPING_TEXT: "is typing..."
5
- }, r = {
6
- sending: "○",
7
- sent: "✓",
8
- delivered: "✓✓",
9
- read: "✓✓",
10
- error: "!"
11
- }, t = {
12
- user: {
13
- bg: "var(--bear-primary-500)",
14
- text: "white"
15
- },
16
- bot: {
17
- bg: "var(--bear-bg-secondary)",
18
- text: "var(--bear-text-primary)"
19
- },
20
- system: {
21
- bg: "transparent",
22
- text: "var(--bear-text-tertiary, var(--bear-text-muted))"
23
- }
24
- };
7
+ }, D = {
8
+ placeholder: A.PLACEHOLDER,
9
+ typingText: A.TYPING_TEXT,
10
+ newMessagesLabel: L
11
+ }, o = E, O = T, s = T, R = T, n = H, e = "--Bear-Chat-height";
25
12
  export {
26
- e as CHAT_DEFAULTS,
27
- r as MESSAGE_STATUS_ICONS,
28
- t as SENDER_COLORS
13
+ A as CHAT_DEFAULTS,
14
+ n as CHAT_DEFAULT_DISABLED,
15
+ R as CHAT_DEFAULT_SHOW_AVATARS,
16
+ s as CHAT_DEFAULT_SHOW_STATUS,
17
+ O as CHAT_DEFAULT_SHOW_TIMESTAMPS,
18
+ D as CHAT_DEFAULT_TRANSLATIONS,
19
+ e as CHAT_HEIGHT_VAR,
20
+ o as CHAT_STICK_THRESHOLD
29
21
  };
@@ -1,21 +1,2 @@
1
- import { FC } from 'react';
2
1
  import { ChatProps } from './Chat.types';
3
- /**
4
- * Chat - Chat interface component
5
- *
6
- * @example
7
- * ```tsx
8
- * const [messages, setMessages] = useState<ChatMessage[]>([
9
- * { id: '1', content: 'Hello!', sender: 'bot', timestamp: new Date() },
10
- * ]);
11
- *
12
- * <Chat
13
- * messages={messages}
14
- * onSend={(msg) => setMessages([...messages, { id: Date.now().toString(), content: msg, sender: 'user' }])}
15
- * isTyping={false}
16
- * showAvatars
17
- * />
18
- * ```
19
- */
20
- export declare const Chat: FC<ChatProps>;
21
- export default Chat;
2
+ export declare const Chat: (props: ChatProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,180 +1,125 @@
1
- import { jsxs as a, jsx as r } from "react/jsx-runtime";
2
- import { useState as B, useRef as R, useEffect as _, useCallback as k } from "react";
3
- import { cn as d } from "../../utils/cn.js";
4
- import { useBear as H } from "../../context/BearProvider.js";
5
- import { Button as O } from "../Button/Button.js";
6
- import { Input as U } from "../Input/Input.js";
7
- import { Avatar as j } from "../Avatar/Avatar.js";
8
- import "../Box/Box.js";
9
- import { Typography as m } from "../Typography/Typography.js";
10
- import { BearIcons as G } from "@forgedevstack/bear-icons";
11
- import { CHAT_DEFAULTS as g, SENDER_COLORS as K, MESSAGE_STATUS_ICONS as V } from "./Chat.const.js";
12
- const z = ({
13
- message: e,
14
- showTimestamp: o = !0,
15
- showStatus: l = !0,
16
- showAvatar: b = !0,
17
- userAvatar: u,
18
- botAvatar: p
19
- }) => {
20
- var s;
21
- const n = e.sender === "user", h = e.sender === "system", i = K[e.sender];
22
- if (h)
23
- return /* @__PURE__ */ r("div", { className: "flex justify-center my-2", children: /* @__PURE__ */ r(
24
- m,
25
- {
26
- variant: "caption",
27
- className: "px-3 py-1 rounded-full bg-gray-100 dark:bg-gray-800",
28
- style: { color: i.text },
29
- children: e.content
1
+ import { jsxs as A, jsx as r } from "react/jsx-runtime";
2
+ import { useRef as T, useState as Z, useEffect as $ } from "react";
3
+ import { BOOLEAN_FALSE as o, COMPONENT_NAME_CHAT as tt, BOOLEAN_TRUE as u } from "../../constants/generals.const.js";
4
+ import { cn as et } from "../../utils/cn.js";
5
+ import { resolveBearId as rt } from "../../utils/generateBearId.utils.js";
6
+ import { useBearId as ot } from "../../utils/useBearId.js";
7
+ import { getBearLiveRegionProps as st } from "../../utils/liveRegion.utils.js";
8
+ import { Box as s } from "../Box/Box.js";
9
+ import { Button as nt } from "../Button/Button.js";
10
+ import { ChatBubble as at } from "../ChatBubble/ChatBubble.js";
11
+ import { ChatError as it } from "../ChatError/ChatError.js";
12
+ import { PromptComposer as lt } from "../PromptComposer/PromptComposer.js";
13
+ import { PromptSuggestions as ct } from "../PromptSuggestions/PromptSuggestions.js";
14
+ import { CHAT_DEFAULT_SHOW_TIMESTAMPS as mt, CHAT_DEFAULT_SHOW_STATUS as ht, CHAT_DEFAULT_SHOW_AVATARS as pt, CHAT_DEFAULTS as dt, CHAT_DEFAULT_DISABLED as At, CHAT_DEFAULT_TRANSLATIONS as Tt } from "./Chat.const.js";
15
+ import { resolveChatHeightVar as ut, isChatScrollerAtBottom as ft } from "./Chat.utils.js";
16
+ import { ChatTypingIndicator as _t } from "./helpers/ChatTypingIndicator.js";
17
+ const Dt = (S) => {
18
+ const {
19
+ id: C,
20
+ testId: B,
21
+ messages: n,
22
+ onSend: E,
23
+ onStop: N,
24
+ onAttach: H,
25
+ isLoading: L = o,
26
+ isStreaming: v = o,
27
+ isTyping: I = o,
28
+ placeholder: w,
29
+ header: f,
30
+ footer: O,
31
+ showTimestamps: R = mt,
32
+ showStatus: y = ht,
33
+ showAvatars: b = pt,
34
+ userAvatar: x,
35
+ botAvatar: D,
36
+ typingText: F,
37
+ className: U,
38
+ height: P = dt.HEIGHT,
39
+ disabled: M = At,
40
+ allowAttach: W,
41
+ suggestions: i,
42
+ onSuggestionSelect: j,
43
+ errorTitle: V,
44
+ errorMessage: _,
45
+ onRetry: k,
46
+ translations: z
47
+ } = S, G = ot(tt), q = rt(C, G), l = T(null), c = T(u), m = T(null), [J, h] = Z(o), p = { ...Tt, ...z }, d = v || L, e = n[n.length - 1], K = d && typeof (e == null ? void 0 : e.content) == "string" ? e.content : void 0, Q = st("info"), g = () => {
48
+ const t = l.current;
49
+ t && (t.scrollTop = t.scrollHeight, c.current = u, h(o));
50
+ }, X = () => {
51
+ const t = l.current;
52
+ if (!t)
53
+ return;
54
+ const a = ft(t);
55
+ c.current = a, a && h(o);
56
+ };
57
+ return $(() => {
58
+ const t = (e == null ? void 0 : e.id) ?? null, a = m.current === null, Y = t !== null && t !== m.current;
59
+ if (m.current = t, !!Y) {
60
+ if (a || c.current) {
61
+ g();
62
+ return;
30
63
  }
31
- ) });
32
- const x = n ? u : p, f = e.status ? V[e.status] : null;
33
- return /* @__PURE__ */ a(
34
- "div",
35
- {
36
- className: d(
37
- "flex gap-2 mb-3",
38
- n ? "flex-row-reverse" : "flex-row"
39
- ),
40
- children: [
41
- b && /* @__PURE__ */ r(
42
- j,
43
- {
44
- src: x,
45
- initials: ((s = e.name) == null ? void 0 : s[0]) || (n ? "U" : "B"),
46
- size: "sm",
47
- className: "flex-shrink-0"
48
- }
49
- ),
50
- /* @__PURE__ */ a("div", { className: d("flex flex-col max-w-[70%]", n ? "items-end" : "items-start"), children: [
51
- e.name && /* @__PURE__ */ r(m, { variant: "caption", className: "mb-1 opacity-60", children: e.name }),
52
- /* @__PURE__ */ r(
53
- "div",
54
- {
55
- className: d(
56
- "px-4 py-2 rounded-2xl",
57
- n ? "rounded-br-sm" : "rounded-bl-sm"
58
- ),
59
- style: {
60
- backgroundColor: i.bg,
61
- color: i.text
62
- },
63
- children: typeof e.content == "string" ? /* @__PURE__ */ r(m, { variant: "body2", children: e.content }) : e.content
64
- }
65
- ),
66
- /* @__PURE__ */ a("div", { className: "flex items-center gap-1 mt-1", children: [
67
- o && e.timestamp && /* @__PURE__ */ r(m, { variant: "caption", className: "opacity-50 text-xs", children: e.timestamp.toLocaleTimeString([], { hour: "2-digit", minute: "2-digit" }) }),
68
- l && f && n && /* @__PURE__ */ r(
69
- "span",
70
- {
71
- className: d(
72
- "text-xs",
73
- e.status === "read" ? "text-blue-500" : "opacity-50",
74
- e.status === "error" && "text-red-500"
75
- ),
76
- children: f
77
- }
78
- )
79
- ] })
80
- ] })
81
- ]
64
+ h(u);
82
65
  }
83
- );
84
- }, L = ({ text: e = g.TYPING_TEXT }) => /* @__PURE__ */ a("div", { className: "flex items-center gap-2 mb-3", children: [
85
- /* @__PURE__ */ a("div", { className: "flex gap-1 px-4 py-3 bg-gray-100 dark:bg-gray-800 rounded-2xl rounded-bl-sm", children: [
86
- /* @__PURE__ */ r("span", { className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: "0ms" } }),
87
- /* @__PURE__ */ r("span", { className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: "150ms" } }),
88
- /* @__PURE__ */ r("span", { className: "w-2 h-2 bg-gray-400 rounded-full animate-bounce", style: { animationDelay: "300ms" } })
89
- ] }),
90
- /* @__PURE__ */ r(m, { variant: "caption", className: "opacity-50", children: e })
91
- ] }), ee = ({
92
- messages: e,
93
- onSend: o,
94
- isLoading: l = !1,
95
- placeholder: b = g.PLACEHOLDER,
96
- header: u,
97
- footer: p,
98
- showTimestamps: n = !0,
99
- showStatus: h = !0,
100
- showAvatars: i = !0,
101
- userAvatar: x,
102
- botAvatar: f,
103
- isTyping: s = !1,
104
- typingText: C,
105
- className: S,
106
- height: v = g.HEIGHT,
107
- testId: T,
108
- disabled: y = !1
109
- }) => {
110
- const { mode: D } = H(), I = D === "dark", [c, w] = B(""), E = R(null);
111
- _(() => {
112
- var t;
113
- (t = E.current) == null || t.scrollIntoView({ behavior: "smooth" });
114
- }, [e, s]);
115
- const N = k(() => {
116
- c.trim() && o && !y && !l && (o(c.trim()), w(""));
117
- }, [c, o, y, l]), A = k((t) => {
118
- t.key === "Enter" && !t.shiftKey && (t.preventDefault(), N());
119
- }, [N]);
120
- return /* @__PURE__ */ a(
121
- "div",
66
+ }, [n, e == null ? void 0 : e.id]), /* @__PURE__ */ A(
67
+ s,
122
68
  {
123
- className: d(
124
- "Bear-Chat",
125
- "flex flex-col rounded-xl overflow-hidden border",
126
- I ? "bg-gray-900 border-gray-700" : "bg-white border-gray-200",
127
- S
128
- ),
129
- style: { height: typeof v == "number" ? `${v}px` : v },
130
- "data-testid": T,
69
+ id: q,
70
+ "data-testid": B,
71
+ className: et("Bear-Chat", U),
72
+ style: ut(P),
131
73
  children: [
132
- u && /* @__PURE__ */ r("div", { className: "px-4 py-3 border-b border-gray-200 dark:border-gray-700", children: u }),
133
- /* @__PURE__ */ a("div", { className: "flex-1 overflow-y-auto p-4", children: [
134
- e.map((t) => /* @__PURE__ */ r(
135
- z,
74
+ f && /* @__PURE__ */ r(s, { className: "Bear-Chat__header", children: f }),
75
+ /* @__PURE__ */ A(s, { ref: l, className: "Bear-Chat__messages", onScroll: X, children: [
76
+ /* @__PURE__ */ r(s, { className: "Bear-Chat__live", ...Q, children: K }),
77
+ n.map((t) => /* @__PURE__ */ r(
78
+ at,
136
79
  {
137
80
  message: t,
138
- showTimestamp: n,
139
- showStatus: h,
140
- showAvatar: i,
81
+ showTimestamp: R,
82
+ showStatus: y,
83
+ showAvatar: b,
141
84
  userAvatar: x,
142
- botAvatar: f
85
+ botAvatar: D
143
86
  },
144
87
  t.id
145
88
  )),
146
- s && /* @__PURE__ */ r(L, { text: C }),
147
- /* @__PURE__ */ r("div", { ref: E })
89
+ I && !d && /* @__PURE__ */ r(_t, { text: F ?? p.typingText }),
90
+ _ && /* @__PURE__ */ r(it, { title: V, onRetry: k, children: _ }),
91
+ J && /* @__PURE__ */ r(
92
+ nt,
93
+ {
94
+ type: "button",
95
+ variant: "primary",
96
+ size: "sm",
97
+ className: "Bear-Chat__new-messages",
98
+ onClick: g,
99
+ children: p.newMessagesLabel
100
+ }
101
+ )
148
102
  ] }),
149
- /* @__PURE__ */ a("div", { className: "p-3 border-t border-gray-200 dark:border-gray-700", children: [
150
- /* @__PURE__ */ a("div", { className: "flex gap-2", children: [
151
- /* @__PURE__ */ r(
152
- U,
153
- {
154
- value: c,
155
- onChange: (t) => w(t.target.value),
156
- onKeyDown: A,
157
- placeholder: b,
158
- disabled: y || l,
159
- className: "flex-1"
160
- }
161
- ),
162
- /* @__PURE__ */ r(
163
- O,
164
- {
165
- variant: "primary",
166
- onClick: N,
167
- disabled: !c.trim() || y || l,
168
- children: /* @__PURE__ */ r(G.SendIcon, { size: 18 })
169
- }
170
- )
171
- ] }),
172
- p && /* @__PURE__ */ r("div", { className: "mt-2", children: p })
103
+ i && i.length > 0 && /* @__PURE__ */ r(s, { className: "Bear-Chat__suggestions", children: /* @__PURE__ */ r(ct, { suggestions: i, onSelect: j }) }),
104
+ /* @__PURE__ */ A(s, { className: "Bear-Chat__composer", children: [
105
+ /* @__PURE__ */ r(
106
+ lt,
107
+ {
108
+ onSubmit: E,
109
+ onStop: N,
110
+ onAttach: H,
111
+ isStreaming: d,
112
+ disabled: M,
113
+ allowAttach: W,
114
+ placeholder: w ?? p.placeholder
115
+ }
116
+ ),
117
+ O
173
118
  ] })
174
119
  ]
175
120
  }
176
121
  );
177
122
  };
178
123
  export {
179
- ee as Chat
124
+ Dt as Chat
180
125
  };