@forgedevstack/bear 1.3.2 → 1.3.4

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 (404) hide show
  1. package/README.md +145 -288
  2. package/dist/components/AlertDialog/AlertDialog.cjs +1 -1
  3. package/dist/components/AlertDialog/AlertDialog.js +67 -84
  4. package/dist/components/ApprovalCard/ApprovalCard.cjs +1 -0
  5. package/dist/components/ApprovalCard/ApprovalCard.const.cjs +1 -0
  6. package/dist/components/ApprovalCard/ApprovalCard.const.d.ts +2 -0
  7. package/dist/components/ApprovalCard/ApprovalCard.const.js +8 -0
  8. package/dist/components/ApprovalCard/ApprovalCard.d.ts +2 -0
  9. package/dist/components/ApprovalCard/ApprovalCard.js +25 -0
  10. package/dist/components/ApprovalCard/ApprovalCard.types.d.ts +15 -0
  11. package/dist/components/ApprovalCard/index.d.ts +2 -0
  12. package/dist/components/ArtifactCard/ArtifactCard.cjs +1 -0
  13. package/dist/components/ArtifactCard/ArtifactCard.const.cjs +1 -0
  14. package/dist/components/ArtifactCard/ArtifactCard.const.d.ts +3 -0
  15. package/dist/components/ArtifactCard/ArtifactCard.const.js +8 -0
  16. package/dist/components/ArtifactCard/ArtifactCard.d.ts +2 -0
  17. package/dist/components/ArtifactCard/ArtifactCard.js +43 -0
  18. package/dist/components/ArtifactCard/ArtifactCard.types.d.ts +15 -0
  19. package/dist/components/ArtifactCard/index.d.ts +2 -0
  20. package/dist/components/Banner/Banner.const.cjs +1 -1
  21. package/dist/components/Banner/Banner.const.js +9 -8
  22. package/dist/components/BottomSheet/BottomSheet.cjs +1 -1
  23. package/dist/components/BottomSheet/BottomSheet.js +72 -64
  24. package/dist/components/Chart/BarChart.cjs +1 -1
  25. package/dist/components/Chart/BarChart.js +65 -72
  26. package/dist/components/Chart/Chart.cjs +1 -1
  27. package/dist/components/Chart/Chart.js +21 -18
  28. package/dist/components/Chart/Chart.types.d.ts +1 -1
  29. package/dist/components/Chart/FunnelChart.cjs +1 -1
  30. package/dist/components/Chart/FunnelChart.js +38 -36
  31. package/dist/components/Chart/LineChart.cjs +1 -1
  32. package/dist/components/Chart/LineChart.js +74 -60
  33. package/dist/components/Chart/PieChart.cjs +1 -1
  34. package/dist/components/Chart/PieChart.js +102 -82
  35. package/dist/components/Chart/RadarChart.cjs +1 -1
  36. package/dist/components/Chart/RadarChart.d.ts +1 -1
  37. package/dist/components/Chart/RadarChart.js +116 -93
  38. package/dist/components/Chat/Chat.cjs +1 -1
  39. package/dist/components/Chat/Chat.const.cjs +1 -1
  40. package/dist/components/Chat/Chat.const.d.ts +9 -22
  41. package/dist/components/Chat/Chat.const.js +18 -26
  42. package/dist/components/Chat/Chat.d.ts +1 -20
  43. package/dist/components/Chat/Chat.js +107 -162
  44. package/dist/components/Chat/Chat.types.d.ts +20 -27
  45. package/dist/components/Chat/Chat.utils.cjs +1 -0
  46. package/dist/components/Chat/Chat.utils.d.ts +2 -0
  47. package/dist/components/Chat/Chat.utils.js +10 -0
  48. package/dist/components/Chat/helpers/ChatTypingIndicator.cjs +1 -0
  49. package/dist/components/Chat/helpers/ChatTypingIndicator.d.ts +3 -0
  50. package/dist/components/Chat/helpers/ChatTypingIndicator.js +14 -0
  51. package/dist/components/Chat/index.d.ts +2 -1
  52. package/dist/components/ChatBubble/ChatBubble.cjs +1 -0
  53. package/dist/components/ChatBubble/ChatBubble.const.cjs +1 -0
  54. package/dist/components/ChatBubble/ChatBubble.const.d.ts +13 -0
  55. package/dist/components/ChatBubble/ChatBubble.const.js +17 -0
  56. package/dist/components/ChatBubble/ChatBubble.d.ts +2 -0
  57. package/dist/components/ChatBubble/ChatBubble.js +32 -0
  58. package/dist/components/ChatBubble/ChatBubble.types.d.ts +12 -0
  59. package/dist/components/ChatBubble/ChatBubble.utils.cjs +1 -0
  60. package/dist/components/ChatBubble/ChatBubble.utils.d.ts +6 -0
  61. package/dist/components/ChatBubble/ChatBubble.utils.js +15 -0
  62. package/dist/components/ChatBubble/helpers/ChatBubbleSystem.cjs +1 -0
  63. package/dist/components/ChatBubble/helpers/ChatBubbleSystem.d.ts +2 -0
  64. package/dist/components/ChatBubble/helpers/ChatBubbleSystem.js +21 -0
  65. package/dist/components/ChatBubble/helpers/ChatBubbleThread.cjs +1 -0
  66. package/dist/components/ChatBubble/helpers/ChatBubbleThread.d.ts +4 -0
  67. package/dist/components/ChatBubble/helpers/ChatBubbleThread.js +63 -0
  68. package/dist/components/ChatBubble/index.d.ts +2 -0
  69. package/dist/components/ChatError/ChatError.cjs +1 -0
  70. package/dist/components/ChatError/ChatError.const.cjs +1 -0
  71. package/dist/components/ChatError/ChatError.const.d.ts +2 -0
  72. package/dist/components/ChatError/ChatError.const.js +8 -0
  73. package/dist/components/ChatError/ChatError.d.ts +2 -0
  74. package/dist/components/ChatError/ChatError.js +32 -0
  75. package/dist/components/ChatError/ChatError.types.d.ts +14 -0
  76. package/dist/components/ChatError/index.d.ts +2 -0
  77. package/dist/components/ChipGroup/ChipGroup.cjs +1 -1
  78. package/dist/components/ChipGroup/ChipGroup.const.cjs +1 -1
  79. package/dist/components/ChipGroup/ChipGroup.const.d.ts +2 -0
  80. package/dist/components/ChipGroup/ChipGroup.const.js +6 -4
  81. package/dist/components/ChipGroup/ChipGroup.js +52 -48
  82. package/dist/components/CitationList/CitationList.cjs +1 -0
  83. package/dist/components/CitationList/CitationList.d.ts +2 -0
  84. package/dist/components/CitationList/CitationList.js +30 -0
  85. package/dist/components/CitationList/CitationList.types.d.ts +15 -0
  86. package/dist/components/CitationList/helpers/CitationListTitle.cjs +1 -0
  87. package/dist/components/CitationList/helpers/CitationListTitle.d.ts +2 -0
  88. package/dist/components/CitationList/helpers/CitationListTitle.js +10 -0
  89. package/dist/components/CitationList/helpers/index.d.ts +1 -0
  90. package/dist/components/CitationList/index.d.ts +2 -0
  91. package/dist/components/CommandPalette/CommandItem.cjs +1 -0
  92. package/dist/components/CommandPalette/CommandItem.d.ts +6 -0
  93. package/dist/components/CommandPalette/CommandItem.js +39 -0
  94. package/dist/components/CommandPalette/CommandPalette.cjs +1 -1
  95. package/dist/components/CommandPalette/CommandPalette.js +129 -144
  96. package/dist/components/ContextMeter/ContextMeter.cjs +1 -0
  97. package/dist/components/ContextMeter/ContextMeter.const.cjs +1 -0
  98. package/dist/components/ContextMeter/ContextMeter.const.d.ts +6 -0
  99. package/dist/components/ContextMeter/ContextMeter.const.js +11 -0
  100. package/dist/components/ContextMeter/ContextMeter.d.ts +2 -0
  101. package/dist/components/ContextMeter/ContextMeter.js +49 -0
  102. package/dist/components/ContextMeter/ContextMeter.types.d.ts +11 -0
  103. package/dist/components/ContextMeter/ContextMeter.utils.cjs +1 -0
  104. package/dist/components/ContextMeter/ContextMeter.utils.d.ts +2 -0
  105. package/dist/components/ContextMeter/ContextMeter.utils.js +12 -0
  106. package/dist/components/ContextMeter/index.d.ts +2 -0
  107. package/dist/components/Drawer/Drawer.cjs +1 -1
  108. package/dist/components/Drawer/Drawer.const.cjs +1 -1
  109. package/dist/components/Drawer/Drawer.const.d.ts +2 -1
  110. package/dist/components/Drawer/Drawer.const.js +7 -6
  111. package/dist/components/Drawer/Drawer.d.ts +1 -1
  112. package/dist/components/Drawer/Drawer.js +101 -85
  113. package/dist/components/Drawer/Drawer.types.d.ts +4 -1
  114. package/dist/components/Drawer/hooks/useDrawer.cjs +1 -1
  115. package/dist/components/Drawer/hooks/useDrawer.js +33 -34
  116. package/dist/components/Drawer/index.d.ts +1 -1
  117. package/dist/components/EmptyState/EmptyState.cjs +1 -1
  118. package/dist/components/EmptyState/EmptyState.const.cjs +1 -1
  119. package/dist/components/EmptyState/EmptyState.const.d.ts +13 -6
  120. package/dist/components/EmptyState/EmptyState.const.js +30 -8
  121. package/dist/components/EmptyState/EmptyState.d.ts +1 -2
  122. package/dist/components/EmptyState/EmptyState.js +37 -41
  123. package/dist/components/EmptyState/EmptyState.types.d.ts +3 -1
  124. package/dist/components/EmptyState/helpers/EmptyStateErrorSvg.cjs +1 -0
  125. package/dist/components/EmptyState/helpers/EmptyStateErrorSvg.d.ts +3 -0
  126. package/dist/components/EmptyState/helpers/EmptyStateErrorSvg.js +8 -0
  127. package/dist/components/EmptyState/helpers/EmptyStateInboxSvg.cjs +1 -0
  128. package/dist/components/EmptyState/helpers/EmptyStateInboxSvg.d.ts +3 -0
  129. package/dist/components/EmptyState/helpers/EmptyStateInboxSvg.js +8 -0
  130. package/dist/components/EmptyState/helpers/EmptyStateSearchSvg.cjs +1 -0
  131. package/dist/components/EmptyState/helpers/EmptyStateSearchSvg.d.ts +3 -0
  132. package/dist/components/EmptyState/helpers/EmptyStateSearchSvg.js +8 -0
  133. package/dist/components/EmptyState/helpers/index.d.ts +3 -0
  134. package/dist/components/EmptyState/index.d.ts +1 -1
  135. package/dist/components/FloatingChat/FloatingChat.cjs +1 -1
  136. package/dist/components/FloatingChat/FloatingChat.const.cjs +1 -1
  137. package/dist/components/FloatingChat/FloatingChat.const.d.ts +12 -1
  138. package/dist/components/FloatingChat/FloatingChat.const.js +25 -7
  139. package/dist/components/FloatingChat/FloatingChat.d.ts +1 -18
  140. package/dist/components/FloatingChat/FloatingChat.js +93 -124
  141. package/dist/components/FloatingChat/FloatingChat.types.d.ts +11 -22
  142. package/dist/components/FloatingChat/FloatingChat.utils.cjs +1 -0
  143. package/dist/components/FloatingChat/FloatingChat.utils.d.ts +2 -0
  144. package/dist/components/FloatingChat/FloatingChat.utils.js +12 -0
  145. package/dist/components/FloatingChat/helpers/FloatingChatHeader.cjs +1 -0
  146. package/dist/components/FloatingChat/helpers/FloatingChatHeader.d.ts +9 -0
  147. package/dist/components/FloatingChat/helpers/FloatingChatHeader.js +21 -0
  148. package/dist/components/FloatingChat/helpers/FloatingChatTrigger.cjs +1 -0
  149. package/dist/components/FloatingChat/helpers/FloatingChatTrigger.d.ts +9 -0
  150. package/dist/components/FloatingChat/helpers/FloatingChatTrigger.js +17 -0
  151. package/dist/components/FloatingChat/index.d.ts +1 -1
  152. package/dist/components/FormSkeleton/FormSkeleton.cjs +1 -1
  153. package/dist/components/FormSkeleton/FormSkeleton.d.ts +1 -1
  154. package/dist/components/FormSkeleton/FormSkeleton.js +35 -24
  155. package/dist/components/HoverCard/HoverCard.cjs +4 -3
  156. package/dist/components/HoverCard/HoverCard.const.cjs +1 -0
  157. package/dist/components/HoverCard/HoverCard.const.d.ts +1 -0
  158. package/dist/components/HoverCard/HoverCard.const.js +10 -0
  159. package/dist/components/HoverCard/HoverCard.js +62 -56
  160. package/dist/components/HoverCard/HoverCard.types.d.ts +7 -0
  161. package/dist/components/Icon/index.d.ts +1 -0
  162. package/dist/components/Icon/productIcons.cjs +1 -0
  163. package/dist/components/Icon/productIcons.d.ts +7 -0
  164. package/dist/components/Icon/productIcons.js +25 -0
  165. package/dist/components/Menu/Menu.cjs +1 -1
  166. package/dist/components/Menu/Menu.const.cjs +1 -0
  167. package/dist/components/Menu/Menu.const.d.ts +2 -0
  168. package/dist/components/Menu/Menu.const.js +12 -0
  169. package/dist/components/Menu/Menu.d.ts +3 -9
  170. package/dist/components/Menu/Menu.js +57 -89
  171. package/dist/components/Menu/Menu.types.d.ts +8 -1
  172. package/dist/components/Menu/MenuDivider.cjs +1 -0
  173. package/dist/components/Menu/MenuDivider.d.ts +6 -0
  174. package/dist/components/Menu/MenuDivider.js +7 -0
  175. package/dist/components/Menu/MenuItem.cjs +1 -0
  176. package/dist/components/Menu/MenuItem.d.ts +6 -0
  177. package/dist/components/Menu/MenuItem.js +46 -0
  178. package/dist/components/MessageActions/MessageActions.cjs +1 -0
  179. package/dist/components/MessageActions/MessageActions.const.cjs +1 -0
  180. package/dist/components/MessageActions/MessageActions.const.d.ts +2 -0
  181. package/dist/components/MessageActions/MessageActions.const.js +10 -0
  182. package/dist/components/MessageActions/MessageActions.d.ts +2 -0
  183. package/dist/components/MessageActions/MessageActions.js +31 -0
  184. package/dist/components/MessageActions/MessageActions.types.d.ts +16 -0
  185. package/dist/components/MessageActions/index.d.ts +2 -0
  186. package/dist/components/Modal/Modal.cjs +1 -1
  187. package/dist/components/Modal/Modal.const.cjs +1 -1
  188. package/dist/components/Modal/Modal.const.d.ts +1 -0
  189. package/dist/components/Modal/Modal.const.js +20 -12
  190. package/dist/components/Modal/Modal.js +62 -59
  191. package/dist/components/Modal/Modal.types.d.ts +7 -0
  192. package/dist/components/ModelSelect/ModelSelect.cjs +1 -0
  193. package/dist/components/ModelSelect/ModelSelect.const.cjs +1 -0
  194. package/dist/components/ModelSelect/ModelSelect.const.d.ts +1 -0
  195. package/dist/components/ModelSelect/ModelSelect.const.js +4 -0
  196. package/dist/components/ModelSelect/ModelSelect.d.ts +2 -0
  197. package/dist/components/ModelSelect/ModelSelect.js +41 -0
  198. package/dist/components/ModelSelect/ModelSelect.types.d.ts +16 -0
  199. package/dist/components/ModelSelect/index.d.ts +2 -0
  200. package/dist/components/OverlayPortal/OverlayPortal.const.cjs +1 -1
  201. package/dist/components/OverlayPortal/OverlayPortal.const.js +6 -5
  202. package/dist/components/PasswordInput/PasswordInput.cjs +1 -1
  203. package/dist/components/PasswordInput/PasswordInput.js +5 -5
  204. package/dist/components/Popover/Popover.cjs +1 -1
  205. package/dist/components/Popover/Popover.const.cjs +1 -0
  206. package/dist/components/Popover/Popover.const.d.ts +15 -1
  207. package/dist/components/Popover/Popover.const.js +29 -0
  208. package/dist/components/Popover/Popover.js +77 -73
  209. package/dist/components/Popover/Popover.types.d.ts +7 -0
  210. package/dist/components/PromptComposer/PromptComposer.cjs +1 -0
  211. package/dist/components/PromptComposer/PromptComposer.const.cjs +1 -0
  212. package/dist/components/PromptComposer/PromptComposer.const.d.ts +6 -0
  213. package/dist/components/PromptComposer/PromptComposer.const.js +14 -0
  214. package/dist/components/PromptComposer/PromptComposer.d.ts +2 -0
  215. package/dist/components/PromptComposer/PromptComposer.js +132 -0
  216. package/dist/components/PromptComposer/PromptComposer.types.d.ts +45 -0
  217. package/dist/components/PromptComposer/PromptComposer.utils.cjs +1 -0
  218. package/dist/components/PromptComposer/PromptComposer.utils.d.ts +5 -0
  219. package/dist/components/PromptComposer/PromptComposer.utils.js +16 -0
  220. package/dist/components/PromptComposer/helpers/PromptComposerAttachSvg.cjs +1 -0
  221. package/dist/components/PromptComposer/helpers/PromptComposerAttachSvg.d.ts +1 -0
  222. package/dist/components/PromptComposer/helpers/PromptComposerAttachSvg.js +6 -0
  223. package/dist/components/PromptComposer/helpers/PromptComposerFileChip.cjs +1 -0
  224. package/dist/components/PromptComposer/helpers/PromptComposerFileChip.d.ts +2 -0
  225. package/dist/components/PromptComposer/helpers/PromptComposerFileChip.js +18 -0
  226. package/dist/components/PromptComposer/helpers/PromptComposerSendSvg.cjs +1 -0
  227. package/dist/components/PromptComposer/helpers/PromptComposerSendSvg.d.ts +1 -0
  228. package/dist/components/PromptComposer/helpers/PromptComposerSendSvg.js +9 -0
  229. package/dist/components/PromptComposer/helpers/PromptComposerStopSvg.cjs +1 -0
  230. package/dist/components/PromptComposer/helpers/PromptComposerStopSvg.d.ts +1 -0
  231. package/dist/components/PromptComposer/helpers/PromptComposerStopSvg.js +6 -0
  232. package/dist/components/PromptComposer/helpers/index.d.ts +4 -0
  233. package/dist/components/PromptComposer/index.d.ts +2 -0
  234. package/dist/components/PromptSuggestions/PromptSuggestions.cjs +1 -0
  235. package/dist/components/PromptSuggestions/PromptSuggestions.d.ts +2 -0
  236. package/dist/components/PromptSuggestions/PromptSuggestions.js +39 -0
  237. package/dist/components/PromptSuggestions/PromptSuggestions.types.d.ts +13 -0
  238. package/dist/components/PromptSuggestions/index.d.ts +2 -0
  239. package/dist/components/RichEditor/helpers/IconRender.cjs +1 -1
  240. package/dist/components/RichEditor/helpers/IconRender.js +16 -16
  241. package/dist/components/RichEditor/helpers/toolbarItemRender.cjs +1 -1
  242. package/dist/components/RichEditor/helpers/toolbarItemRender.js +23 -23
  243. package/dist/components/Select/Select.cjs +1 -1
  244. package/dist/components/Select/Select.const.cjs +1 -1
  245. package/dist/components/Select/Select.const.d.ts +1 -0
  246. package/dist/components/Select/Select.const.js +7 -6
  247. package/dist/components/Select/Select.js +110 -105
  248. package/dist/components/Select/helpers/SelectCheckSvg.cjs +1 -0
  249. package/dist/components/Select/helpers/SelectCheckSvg.d.ts +3 -0
  250. package/dist/components/Select/helpers/SelectCheckSvg.js +8 -0
  251. package/dist/components/Select/helpers/SelectChevronDownSvg.cjs +1 -0
  252. package/dist/components/Select/helpers/SelectChevronDownSvg.d.ts +3 -0
  253. package/dist/components/Select/helpers/SelectChevronDownSvg.js +8 -0
  254. package/dist/components/Select/helpers/index.d.ts +2 -0
  255. package/dist/components/Skeleton/Skeleton.cjs +1 -1
  256. package/dist/components/Skeleton/Skeleton.const.cjs +2 -2
  257. package/dist/components/Skeleton/Skeleton.const.js +5 -6
  258. package/dist/components/Skeleton/Skeleton.js +59 -59
  259. package/dist/components/StatCard/StatCard.cjs +1 -1
  260. package/dist/components/StatCard/StatCard.const.cjs +1 -1
  261. package/dist/components/StatCard/StatCard.const.d.ts +0 -7
  262. package/dist/components/StatCard/StatCard.const.js +5 -12
  263. package/dist/components/StatCard/StatCard.d.ts +1 -2
  264. package/dist/components/StatCard/StatCard.js +48 -37
  265. package/dist/components/StatCard/StatCard.utils.cjs +1 -0
  266. package/dist/components/StatCard/StatCard.utils.d.ts +2 -0
  267. package/dist/components/StatCard/StatCard.utils.js +7 -0
  268. package/dist/components/StreamingMessage/StreamingMessage.cjs +1 -0
  269. package/dist/components/StreamingMessage/StreamingMessage.const.cjs +1 -0
  270. package/dist/components/StreamingMessage/StreamingMessage.const.d.ts +5 -0
  271. package/dist/components/StreamingMessage/StreamingMessage.const.js +10 -0
  272. package/dist/components/StreamingMessage/StreamingMessage.d.ts +2 -0
  273. package/dist/components/StreamingMessage/StreamingMessage.js +48 -0
  274. package/dist/components/StreamingMessage/StreamingMessage.types.d.ts +15 -0
  275. package/dist/components/StreamingMessage/index.d.ts +2 -0
  276. package/dist/components/ThemeSwitcher/ThemeSwitcher.cjs +1 -0
  277. package/dist/components/ThemeSwitcher/ThemeSwitcher.const.cjs +1 -0
  278. package/dist/components/ThemeSwitcher/ThemeSwitcher.const.d.ts +7 -0
  279. package/dist/components/ThemeSwitcher/ThemeSwitcher.const.js +14 -0
  280. package/dist/components/ThemeSwitcher/ThemeSwitcher.d.ts +2 -0
  281. package/dist/components/ThemeSwitcher/ThemeSwitcher.js +39 -0
  282. package/dist/components/ThemeSwitcher/ThemeSwitcher.types.d.ts +14 -0
  283. package/dist/components/ThemeSwitcher/index.d.ts +2 -0
  284. package/dist/components/ThinkingBlock/ThinkingBlock.cjs +1 -0
  285. package/dist/components/ThinkingBlock/ThinkingBlock.const.cjs +1 -0
  286. package/dist/components/ThinkingBlock/ThinkingBlock.const.d.ts +4 -0
  287. package/dist/components/ThinkingBlock/ThinkingBlock.const.js +9 -0
  288. package/dist/components/ThinkingBlock/ThinkingBlock.d.ts +2 -0
  289. package/dist/components/ThinkingBlock/ThinkingBlock.js +45 -0
  290. package/dist/components/ThinkingBlock/ThinkingBlock.types.d.ts +16 -0
  291. package/dist/components/ThinkingBlock/index.d.ts +2 -0
  292. package/dist/components/Toast/Toast.cjs +1 -1
  293. package/dist/components/Toast/Toast.const.cjs +1 -1
  294. package/dist/components/Toast/Toast.const.d.ts +2 -0
  295. package/dist/components/Toast/Toast.const.js +11 -8
  296. package/dist/components/Toast/Toast.context.cjs +1 -0
  297. package/dist/components/Toast/Toast.context.d.ts +3 -0
  298. package/dist/components/Toast/Toast.context.js +11 -0
  299. package/dist/components/Toast/Toast.d.ts +4 -3
  300. package/dist/components/Toast/Toast.icons.cjs +1 -0
  301. package/dist/components/Toast/Toast.icons.d.ts +4 -0
  302. package/dist/components/Toast/Toast.icons.js +29 -0
  303. package/dist/components/Toast/Toast.js +32 -160
  304. package/dist/components/Toast/ToastContainer.cjs +1 -0
  305. package/dist/components/Toast/ToastContainer.d.ts +3 -0
  306. package/dist/components/Toast/ToastContainer.js +39 -0
  307. package/dist/components/Toast/ToastItem.cjs +1 -0
  308. package/dist/components/Toast/ToastItem.d.ts +5 -0
  309. package/dist/components/Toast/ToastItem.js +86 -0
  310. package/dist/components/ToggleGroup/ToggleGroup.cjs +1 -0
  311. package/dist/components/ToggleGroup/ToggleGroup.const.cjs +1 -0
  312. package/dist/components/ToggleGroup/ToggleGroup.const.d.ts +15 -0
  313. package/dist/components/ToggleGroup/ToggleGroup.const.js +33 -0
  314. package/dist/components/ToggleGroup/ToggleGroup.context.cjs +1 -0
  315. package/dist/components/ToggleGroup/ToggleGroup.context.d.ts +2 -0
  316. package/dist/components/ToggleGroup/ToggleGroup.context.js +5 -0
  317. package/dist/components/ToggleGroup/ToggleGroup.d.ts +2 -0
  318. package/dist/components/ToggleGroup/ToggleGroup.js +86 -0
  319. package/dist/components/ToggleGroup/ToggleGroup.types.d.ts +48 -0
  320. package/dist/components/ToggleGroup/ToggleGroupItem.cjs +1 -0
  321. package/dist/components/ToggleGroup/ToggleGroupItem.d.ts +2 -0
  322. package/dist/components/ToggleGroup/ToggleGroupItem.js +50 -0
  323. package/dist/components/ToggleGroup/hooks/useToggleGroupContext.cjs +1 -0
  324. package/dist/components/ToggleGroup/hooks/useToggleGroupContext.d.ts +1 -0
  325. package/dist/components/ToggleGroup/hooks/useToggleGroupContext.js +6 -0
  326. package/dist/components/ToggleGroup/index.d.ts +4 -0
  327. package/dist/components/ToolCall/ToolCall.cjs +1 -0
  328. package/dist/components/ToolCall/ToolCall.const.cjs +1 -0
  329. package/dist/components/ToolCall/ToolCall.const.d.ts +5 -0
  330. package/dist/components/ToolCall/ToolCall.const.js +17 -0
  331. package/dist/components/ToolCall/ToolCall.d.ts +2 -0
  332. package/dist/components/ToolCall/ToolCall.js +43 -0
  333. package/dist/components/ToolCall/ToolCall.types.d.ts +20 -0
  334. package/dist/components/ToolCall/index.d.ts +2 -0
  335. package/dist/components/Tooltip/Tooltip.cjs +1 -1
  336. package/dist/components/Tooltip/Tooltip.const.cjs +1 -0
  337. package/dist/components/Tooltip/Tooltip.const.d.ts +8 -0
  338. package/dist/components/Tooltip/Tooltip.const.js +18 -0
  339. package/dist/components/Tooltip/Tooltip.js +59 -61
  340. package/dist/components/Tooltip/Tooltip.types.d.ts +7 -0
  341. package/dist/components/Transition/Transition.const.cjs +1 -1
  342. package/dist/components/Transition/Transition.const.js +12 -6
  343. package/dist/components/Transition/Transition.types.d.ts +1 -1
  344. package/dist/components/index.cjs +1 -1
  345. package/dist/components/index.d.ts +39 -9
  346. package/dist/components/index.js +335 -293
  347. package/dist/constants/generals.const.cjs +1 -1
  348. package/dist/constants/generals.const.d.ts +46 -0
  349. package/dist/constants/generals.const.js +158 -115
  350. package/dist/constants/keys.const.cjs +1 -1
  351. package/dist/constants/keys.const.js +2 -1
  352. package/dist/constants/numbers.const.cjs +1 -1
  353. package/dist/constants/numbers.const.d.ts +10 -0
  354. package/dist/constants/numbers.const.js +64 -53
  355. package/dist/context/BearProvider.cjs +1 -1
  356. package/dist/context/BearProvider.d.ts +19 -44
  357. package/dist/context/BearProvider.js +223 -208
  358. package/dist/context/bearProvider.types.d.ts +4 -0
  359. package/dist/context/index.d.ts +1 -1
  360. package/dist/hooks/index.cjs +1 -1
  361. package/dist/hooks/index.d.ts +2 -0
  362. package/dist/hooks/index.js +6 -4
  363. package/dist/hooks/useFixedAnchorPosition/index.d.ts +1 -1
  364. package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.cjs +1 -1
  365. package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.d.ts +2 -1
  366. package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.const.js +12 -11
  367. package/dist/hooks/useFixedAnchorPosition/useFixedAnchorPosition.types.d.ts +1 -1
  368. package/dist/hooks/useFocusTrap/index.d.ts +2 -0
  369. package/dist/hooks/useFocusTrap/useFocusTrap.cjs +1 -0
  370. package/dist/hooks/useFocusTrap/useFocusTrap.d.ts +3 -0
  371. package/dist/hooks/useFocusTrap/useFocusTrap.js +41 -0
  372. package/dist/hooks/useFocusTrap/useFocusTrap.types.d.ts +8 -0
  373. package/dist/hooks/useFocusTrap/useFocusTrap.utils.cjs +1 -0
  374. package/dist/hooks/useFocusTrap/useFocusTrap.utils.d.ts +1 -0
  375. package/dist/hooks/useFocusTrap/useFocusTrap.utils.js +23 -0
  376. package/dist/index.cjs +1 -1
  377. package/dist/index.js +483 -439
  378. package/dist/styles/_ai-chat.css +487 -0
  379. package/dist/styles/_base.css +2 -0
  380. package/dist/styles/_chart.css +144 -0
  381. package/dist/styles/_effects.css +8 -4
  382. package/dist/styles/_skeleton.css +90 -0
  383. package/dist/styles/main.css +3 -0
  384. package/dist/styles.css +953 -199
  385. package/package.json +1 -1
  386. package/dist/components/FormSkeleton/FormSkeleton.const.cjs +0 -1
  387. package/dist/components/FormSkeleton/FormSkeleton.const.d.ts +0 -5
  388. package/dist/components/FormSkeleton/FormSkeleton.const.js +0 -8
  389. package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.cjs +0 -1
  390. package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.const.cjs +0 -1
  391. package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.const.js +0 -14
  392. package/dist/node_modules/@forgedevstack/bear-icons/dist/Icon.js +0 -35
  393. package/dist/node_modules/@forgedevstack/bear-icons/dist/action.cjs +0 -1
  394. package/dist/node_modules/@forgedevstack/bear-icons/dist/action.js +0 -26
  395. package/dist/node_modules/@forgedevstack/bear-icons/dist/cn.utils.cjs +0 -1
  396. package/dist/node_modules/@forgedevstack/bear-icons/dist/cn.utils.js +0 -4
  397. package/dist/node_modules/@forgedevstack/bear-icons/dist/editor.cjs +0 -1
  398. package/dist/node_modules/@forgedevstack/bear-icons/dist/editor.js +0 -130
  399. package/dist/node_modules/@forgedevstack/bear-icons/dist/misc.cjs +0 -1
  400. package/dist/node_modules/@forgedevstack/bear-icons/dist/misc.js +0 -12
  401. package/dist/node_modules/@forgedevstack/bear-icons/dist/navigation.cjs +0 -1
  402. package/dist/node_modules/@forgedevstack/bear-icons/dist/navigation.js +0 -18
  403. package/dist/node_modules/@forgedevstack/bear-icons/dist/status.cjs +0 -1
  404. package/dist/node_modules/@forgedevstack/bear-icons/dist/status.js +0 -6
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),s=require("../../constants/numbers.const.cjs"),l=require("../../utils/cn.cjs");require("react");const c=require("./Chart.const.cjs"),m=require("./Chart.utils.cjs"),B=w=>{const{data:o,height:R=c.CHART.DEFAULT_HEIGHT,showLabels:x=!0,showValues:C=!1,animated:$=!0,color:j,orientation:v="vertical",barRadius:t=c.CHART.DEFAULT_BAR_RADIUS,barGap:y=c.CHART.DEFAULT_BAR_GAP,stacked:b=!1,className:A,...E}=w,u=o.map(a=>m.getStackTotal(a.stacks,a.value)),N=Math.max(...u,s.ONE),e=v==="vertical";return r.jsx("div",{className:l.cn("Bear-Chart Bear-Chart--bar bear-w-full",A),style:{height:R},...E,children:r.jsx("div",{className:l.cn("bear-h-full",e?"bear-flex bear-items-end bear-justify-between":"bear-flex bear-flex-col bear-justify-between"),style:{gap:`${y}rem`},children:o.map((a,h)=>{const d=b&&a.stacks&&a.stacks.length>s.ZERO?a.stacks:[a.value],n=u[h],f=n/N*c.CHART.VIEWBOX;return r.jsxs("div",{className:l.cn(e?"bear-flex-1 bear-flex bear-flex-col bear-items-center bear-gap-1":"bear-flex-1 bear-flex bear-items-center bear-gap-2"),children:[x&&!e&&r.jsx("span",{className:"bear-w-16 bear-truncate bear-text-xs bear-text-gray-600 dark:bear-text-slate-300",children:a.label}),r.jsx("div",{className:l.cn(e?"bear-w-full bear-flex-1 bear-flex bear-items-end":"bear-flex-1 bear-h-full bear-flex bear-items-center"),children:r.jsx("div",{className:l.cn("bear-flex",e?"bear-w-full bear-flex-col-reverse":"bear-h-3/4 bear-flex-row",$&&(e?"animate-grow-up":"animate-grow-right")),style:e?{height:`${f}%`}:{width:`${f}%`},children:d.map((T,i)=>{const k=n>s.ZERO?T/n*c.CHART.VIEWBOX:s.ZERO,O=i===s.ZERO,p=i===d.length-s.ONE,g=b?e?p?`${t}px ${t}px 0 0`:"0":p?`0 ${t}px ${t}px 0`:"0":e?`${t}px ${t}px 0 0`:`0 ${t}px ${t}px 0`;return r.jsx("div",{className:"bear-transition-all bear-duration-500 bear-ease-out",style:{[e?"height":"width"]:`${k}%`,[e?"width":"height"]:"100%",backgroundColor:m.getChartColor(b?i:h,a.color||j),borderRadius:g,opacity:.9}},`${a.label}-${i}`)})})}),C&&r.jsx("span",{className:"bear-text-xs bear-text-gray-500 dark:bear-text-slate-400",children:n}),x&&e&&r.jsx("span",{className:"bear-max-w-full bear-truncate bear-text-xs bear-text-gray-600 dark:bear-text-slate-300",children:a.label})]},a.label)})})})};exports.BarChart=B;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),s=require("../../constants/numbers.const.cjs"),p=require("../../utils/cn.cjs");require("react");const V=require("../../utils/generateBearId.utils.cjs"),w=require("../../utils/useBearId.cjs"),c=require("./Chart.const.cjs"),x=require("./Chart.utils.cjs"),z=g=>{const{data:i,height:m=c.CHART.DEFAULT_HEIGHT,showLabels:h=!0,showValues:v=!1,animated:R=!0,color:$,orientation:b="vertical",barRadius:r=c.CHART.DEFAULT_BAR_RADIUS,barGap:A=c.CHART.DEFAULT_BAR_GAP,stacked:l=!1,className:E,id:N,testId:j,...T}=g,O=w.useBearId("BarChart"),k=V.resolveBearId(N,O),d=i.map(a=>x.getStackTotal(a.stacks,a.value)),q=Math.max(...d,s.ONE),t=b==="vertical",y={"--Bear-Chart-height":`${m}px`,"--Bear-Chart-gap":`${A}rem`};return e.jsx("div",{id:k,"data-testid":j,className:p.cn("Bear-Chart Bear-Chart--bar",t?"Bear-Chart--vertical":"Bear-Chart--horizontal",E),style:y,...T,children:e.jsx("div",{className:"Bear-Chart__track",children:i.map((a,u)=>{const C=l&&a.stacks&&a.stacks.length>s.ZERO?a.stacks:[a.value],o=d[u],I={"--Bear-Chart-size":`${o/q*c.CHART.VIEWBOX}%`};return e.jsxs("div",{className:"Bear-Chart__col",children:[h&&!t&&e.jsx("span",{className:"Bear-Chart__label",children:a.label}),e.jsx("div",{className:"Bear-Chart__plot",children:e.jsx("div",{className:p.cn("Bear-Chart__stack",R&&(t?"animate-grow-up":"animate-grow-right")),style:I,children:C.map((H,n)=>{const S=o>s.ZERO?H/o*c.CHART.VIEWBOX:s.ZERO,L=n===s.ZERO,B=n===C.length-s.ONE,_=l?t?B?`${r}px ${r}px 0 0`:"0":B?`0 ${r}px ${r}px 0`:"0":t?`${r}px ${r}px 0 0`:`0 ${r}px ${r}px 0`,P={"--Bear-Chart-segment":`${S}%`,"--Bear-Chart-color":x.getChartColor(l?n:u,a.color||$),"--Bear-Chart-radius":_};return e.jsx("div",{className:"Bear-Chart__segment",style:P},`${a.label}-${n}`)})})}),v&&e.jsx("span",{className:"Bear-Chart__value",children:o}),h&&t&&e.jsx("span",{className:"Bear-Chart__label",children:a.label})]},a.label)})})})};exports.BarChart=z;
@@ -1,85 +1,78 @@
1
- import { jsx as t, jsxs as V } from "react/jsx-runtime";
2
- import { ONE as g, ZERO as i } from "../../constants/numbers.const.js";
3
- import { cn as l } from "../../utils/cn.js";
1
+ import { jsx as t, jsxs as F } from "react/jsx-runtime";
2
+ import { ONE as _, ZERO as h } from "../../constants/numbers.const.js";
3
+ import { cn as u } from "../../utils/cn.js";
4
4
  import "react";
5
+ import { resolveBearId as O } from "../../utils/generateBearId.utils.js";
6
+ import { useBearId as P } from "../../utils/useBearId.js";
5
7
  import { CHART as s } from "./Chart.const.js";
6
- import { getStackTotal as _, getChartColor as j } from "./Chart.utils.js";
7
- const P = (w) => {
8
+ import { getStackTotal as U, getChartColor as G } from "./Chart.utils.js";
9
+ const Q = ($) => {
8
10
  const {
9
11
  data: n,
10
- height: $ = s.DEFAULT_HEIGHT,
11
- showLabels: x = !0,
12
+ height: g = s.DEFAULT_HEIGHT,
13
+ showLabels: i = !0,
12
14
  showValues: v = !1,
13
15
  animated: N = !0,
14
- color: k,
15
- orientation: y = "vertical",
16
+ color: b,
17
+ orientation: x = "vertical",
16
18
  barRadius: r = s.DEFAULT_BAR_RADIUS,
17
- barGap: A = s.DEFAULT_BAR_GAP,
18
- stacked: b = !1,
19
- className: E,
20
- ...B
21
- } = w, h = n.map((a) => _(a.stacks, a.value)), C = Math.max(...h, g), e = y === "vertical";
22
- return /* @__PURE__ */ t("div", { className: l("Bear-Chart Bear-Chart--bar bear-w-full", E), style: { height: $ }, ...B, children: /* @__PURE__ */ t(
19
+ barGap: f = s.DEFAULT_BAR_GAP,
20
+ stacked: l = !1,
21
+ className: k,
22
+ id: A,
23
+ testId: E,
24
+ ...y
25
+ } = $, I = P("BarChart"), R = O(A, I), m = n.map((a) => U(a.stacks, a.value)), T = Math.max(...m, _), e = x === "vertical", L = {
26
+ "--Bear-Chart-height": `${g}px`,
27
+ "--Bear-Chart-gap": `${f}rem`
28
+ };
29
+ return /* @__PURE__ */ t(
23
30
  "div",
24
31
  {
25
- className: l("bear-h-full", e ? "bear-flex bear-items-end bear-justify-between" : "bear-flex bear-flex-col bear-justify-between"),
26
- style: { gap: `${A}rem` },
27
- children: n.map((a, f) => {
28
- const d = b && a.stacks && a.stacks.length > i ? a.stacks : [a.value], c = h[f], p = c / C * s.VIEWBOX;
29
- return /* @__PURE__ */ V(
30
- "div",
31
- {
32
- className: l(
33
- e ? "bear-flex-1 bear-flex bear-flex-col bear-items-center bear-gap-1" : "bear-flex-1 bear-flex bear-items-center bear-gap-2"
34
- ),
35
- children: [
36
- x && !e && /* @__PURE__ */ t("span", { className: "bear-w-16 bear-truncate bear-text-xs bear-text-gray-600 dark:bear-text-slate-300", children: a.label }),
37
- /* @__PURE__ */ t(
38
- "div",
39
- {
40
- className: l(
41
- e ? "bear-w-full bear-flex-1 bear-flex bear-items-end" : "bear-flex-1 bear-h-full bear-flex bear-items-center"
42
- ),
43
- children: /* @__PURE__ */ t(
44
- "div",
45
- {
46
- className: l(
47
- "bear-flex",
48
- e ? "bear-w-full bear-flex-col-reverse" : "bear-h-3/4 bear-flex-row",
49
- N && (e ? "animate-grow-up" : "animate-grow-right")
50
- ),
51
- style: e ? { height: `${p}%` } : { width: `${p}%` },
52
- children: d.map((R, o) => {
53
- const T = c > i ? R / c * s.VIEWBOX : i, L = o === i, m = o === d.length - g, u = b ? e ? m ? `${r}px ${r}px 0 0` : "0" : m ? `0 ${r}px ${r}px 0` : "0" : e ? `${r}px ${r}px 0 0` : `0 ${r}px ${r}px 0`;
54
- return /* @__PURE__ */ t(
55
- "div",
56
- {
57
- className: "bear-transition-all bear-duration-500 bear-ease-out",
58
- style: {
59
- [e ? "height" : "width"]: `${T}%`,
60
- [e ? "width" : "height"]: "100%",
61
- backgroundColor: j(b ? o : f, a.color || k),
62
- borderRadius: u,
63
- opacity: 0.9
64
- }
65
- },
66
- `${a.label}-${o}`
67
- );
68
- })
69
- }
70
- )
71
- }
72
- ),
73
- v && /* @__PURE__ */ t("span", { className: "bear-text-xs bear-text-gray-500 dark:bear-text-slate-400", children: c }),
74
- x && e && /* @__PURE__ */ t("span", { className: "bear-max-w-full bear-truncate bear-text-xs bear-text-gray-600 dark:bear-text-slate-300", children: a.label })
75
- ]
76
- },
77
- a.label
78
- );
79
- })
32
+ id: R,
33
+ "data-testid": E,
34
+ className: u(
35
+ "Bear-Chart Bear-Chart--bar",
36
+ e ? "Bear-Chart--vertical" : "Bear-Chart--horizontal",
37
+ k
38
+ ),
39
+ style: L,
40
+ ...y,
41
+ children: /* @__PURE__ */ t("div", { className: "Bear-Chart__track", children: n.map((a, p) => {
42
+ const d = l && a.stacks && a.stacks.length > h ? a.stacks : [a.value], o = m[p], S = {
43
+ "--Bear-Chart-size": `${o / T * s.VIEWBOX}%`
44
+ };
45
+ return /* @__PURE__ */ F("div", { className: "Bear-Chart__col", children: [
46
+ i && !e && /* @__PURE__ */ t("span", { className: "Bear-Chart__label", children: a.label }),
47
+ /* @__PURE__ */ t("div", { className: "Bear-Chart__plot", children: /* @__PURE__ */ t(
48
+ "div",
49
+ {
50
+ className: u("Bear-Chart__stack", N && (e ? "animate-grow-up" : "animate-grow-right")),
51
+ style: S,
52
+ children: d.map((V, c) => {
53
+ const w = o > h ? V / o * s.VIEWBOX : h, z = c === h, B = c === d.length - _, C = l ? e ? B ? `${r}px ${r}px 0 0` : "0" : B ? `0 ${r}px ${r}px 0` : "0" : e ? `${r}px ${r}px 0 0` : `0 ${r}px ${r}px 0`, D = {
54
+ "--Bear-Chart-segment": `${w}%`,
55
+ "--Bear-Chart-color": G(l ? c : p, a.color || b),
56
+ "--Bear-Chart-radius": C
57
+ };
58
+ return /* @__PURE__ */ t(
59
+ "div",
60
+ {
61
+ className: "Bear-Chart__segment",
62
+ style: D
63
+ },
64
+ `${a.label}-${c}`
65
+ );
66
+ })
67
+ }
68
+ ) }),
69
+ v && /* @__PURE__ */ t("span", { className: "Bear-Chart__value", children: o }),
70
+ i && e && /* @__PURE__ */ t("span", { className: "Bear-Chart__label", children: a.label })
71
+ ] }, a.label);
72
+ }) })
80
73
  }
81
- ) });
74
+ );
82
75
  };
83
76
  export {
84
- P as BarChart
77
+ Q as BarChart
85
78
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),a=require("./BarChart.cjs"),C=require("./LineChart.cjs"),n=require("./PieChart.cjs"),i=require("./RadarChart.cjs"),A=require("./FunnelChart.cjs"),t=require("./Chart.const.cjs"),s={[t.CHART_TYPES.BAR]:r=>e.jsx(a.BarChart,{...r}),[t.CHART_TYPES.STACKED]:r=>e.jsx(a.BarChart,{...r,stacked:!0}),[t.CHART_TYPES.LINE]:r=>e.jsx(C.LineChart,{...r}),[t.CHART_TYPES.AREA]:r=>e.jsx(C.LineChart,{...r,fill:!0}),[t.CHART_TYPES.PIE]:r=>e.jsx(n.PieChart,{...r}),[t.CHART_TYPES.DONUT]:r=>e.jsx(n.PieChart,{...r,innerRadius:t.CHART.DEFAULT_INNER_RADIUS}),[t.CHART_TYPES.RADAR]:r=>e.jsx(i.RadarChart,{...r}),[t.CHART_TYPES.FUNNEL]:r=>e.jsx(A.FunnelChart,{...r})},E=r=>{const{type:R,...T}=r;return(s[R]??s[t.CHART_TYPES.BAR])(T)};exports.Chart=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime");require("react");const A=require("../../utils/generateBearId.utils.cjs"),c=require("../../utils/useBearId.cjs"),a=require("./BarChart.cjs"),s=require("./LineChart.cjs"),n=require("./PieChart.cjs"),E=require("./RadarChart.cjs"),d=require("./FunnelChart.cjs"),e=require("./Chart.const.cjs"),C={[e.CHART_TYPES.BAR]:r=>t.jsx(a.BarChart,{...r}),[e.CHART_TYPES.STACKED]:r=>t.jsx(a.BarChart,{...r,stacked:!0}),[e.CHART_TYPES.LINE]:r=>t.jsx(s.LineChart,{...r}),[e.CHART_TYPES.AREA]:r=>t.jsx(s.LineChart,{...r,fill:!0}),[e.CHART_TYPES.PIE]:r=>t.jsx(n.PieChart,{...r}),[e.CHART_TYPES.DONUT]:r=>t.jsx(n.PieChart,{...r,innerRadius:e.CHART.DEFAULT_INNER_RADIUS}),[e.CHART_TYPES.RADAR]:r=>t.jsx(E.RadarChart,{...r}),[e.CHART_TYPES.FUNNEL]:r=>t.jsx(d.FunnelChart,{...r})},h=r=>{const{type:R=e.CHART_TYPES.BAR,id:i,...T}=r,o=c.useBearId("Chart"),u=A.resolveBearId(i,o);return(C[R]??C[e.CHART_TYPES.BAR])({...T,id:u})};exports.Chart=h;
@@ -1,23 +1,26 @@
1
1
  import { jsx as o } from "react/jsx-runtime";
2
- import { BarChart as R } from "./BarChart.js";
3
- import { LineChart as e } from "./LineChart.js";
4
- import { PieChart as m } from "./PieChart.js";
5
- import { RadarChart as A } from "./RadarChart.js";
6
- import { FunnelChart as E } from "./FunnelChart.js";
7
- import { CHART_TYPES as t, CHART as p } from "./Chart.const.js";
2
+ import "react";
3
+ import { resolveBearId as s } from "../../utils/generateBearId.utils.js";
4
+ import { useBearId as C } from "../../utils/useBearId.js";
5
+ import { BarChart as e } from "./BarChart.js";
6
+ import { LineChart as m } from "./LineChart.js";
7
+ import { PieChart as i } from "./PieChart.js";
8
+ import { RadarChart as E } from "./RadarChart.js";
9
+ import { FunnelChart as f } from "./FunnelChart.js";
10
+ import { CHART_TYPES as t, CHART as c } from "./Chart.const.js";
8
11
  const a = {
9
- [t.BAR]: (r) => /* @__PURE__ */ o(R, { ...r }),
10
- [t.STACKED]: (r) => /* @__PURE__ */ o(R, { ...r, stacked: !0 }),
11
- [t.LINE]: (r) => /* @__PURE__ */ o(e, { ...r }),
12
- [t.AREA]: (r) => /* @__PURE__ */ o(e, { ...r, fill: !0 }),
13
- [t.PIE]: (r) => /* @__PURE__ */ o(m, { ...r }),
14
- [t.DONUT]: (r) => /* @__PURE__ */ o(m, { ...r, innerRadius: p.DEFAULT_INNER_RADIUS }),
15
- [t.RADAR]: (r) => /* @__PURE__ */ o(A, { ...r }),
16
- [t.FUNNEL]: (r) => /* @__PURE__ */ o(E, { ...r })
17
- }, d = (r) => {
18
- const { type: i, ...n } = r;
19
- return (a[i] ?? a[t.BAR])(n);
12
+ [t.BAR]: (r) => /* @__PURE__ */ o(e, { ...r }),
13
+ [t.STACKED]: (r) => /* @__PURE__ */ o(e, { ...r, stacked: !0 }),
14
+ [t.LINE]: (r) => /* @__PURE__ */ o(m, { ...r }),
15
+ [t.AREA]: (r) => /* @__PURE__ */ o(m, { ...r, fill: !0 }),
16
+ [t.PIE]: (r) => /* @__PURE__ */ o(i, { ...r }),
17
+ [t.DONUT]: (r) => /* @__PURE__ */ o(i, { ...r, innerRadius: c.DEFAULT_INNER_RADIUS }),
18
+ [t.RADAR]: (r) => /* @__PURE__ */ o(E, { ...r }),
19
+ [t.FUNNEL]: (r) => /* @__PURE__ */ o(f, { ...r })
20
+ }, U = (r) => {
21
+ const { type: R = t.BAR, id: n, ...d } = r, p = C("Chart"), A = s(n, p);
22
+ return (a[R] ?? a[t.BAR])({ ...d, id: A });
20
23
  };
21
24
  export {
22
- d as Chart
25
+ U as Chart
23
26
  };
@@ -10,7 +10,7 @@ export interface ChartDataPoint {
10
10
  }
11
11
  export interface ChartProps extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
12
12
  testId?: string;
13
- type: ChartType;
13
+ type?: ChartType;
14
14
  data: ChartDataPoint[];
15
15
  height?: number;
16
16
  showLabels?: boolean;
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),n=require("../../constants/numbers.const.cjs"),o=require("../../utils/cn.cjs");require("react");const b=require("../Box/Box.cjs"),l=require("../Flex/Flex.cjs"),p=require("../Typography/Typography.cjs"),r=require("./Chart.const.cjs"),H=require("./Chart.utils.cjs"),_=s=>{const{data:a,height:c=r.CHART.DEFAULT_HEIGHT,showLabels:u=!0,showValues:i=!0,animated:h=!0,color:d,className:m,...C}=s,g=Math.max(...a.map(e=>e.value),n.ONE);return t.jsx(l.Flex,{direction:"column",gap:1,justify:"center",className:o.cn("Bear-Chart Bear-Chart--funnel bear-w-full",m),style:{height:c},...C,children:a.map((e,x)=>{const N=Math.max(e.value/g*r.CHART.VIEWBOX,r.CHART.FUNNEL_MIN_WIDTH),T=H.getChartColor(x,e.color||d);return t.jsxs(l.Flex,{direction:"column",align:"center",gap:1,className:"bear-w-full",children:[t.jsx(b.Box,{className:o.cn("Bear-Chart__funnel-step bear-rounded-md",h&&"animate-grow-right"),style:{width:`${N}%`,height:`${r.CHART.VIEWBOX/Math.max(a.length,n.ONE)/2}%`,minHeight:r.CHART.FUNNEL_MIN_WIDTH,backgroundColor:T}}),u&&t.jsxs(p.Typography,{variant:"caption",color:"muted",children:[e.label,i?` · ${e.value}`:""]})]},e.label)})})};exports.FunnelChart=_;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),n=require("../../constants/numbers.const.cjs"),s=require("../../utils/cn.cjs");require("react");const N=require("../../utils/generateBearId.utils.cjs"),_=require("../../utils/useBearId.cjs"),b=require("../Box/Box.cjs"),o=require("../Flex/Flex.cjs"),F=require("../Typography/Typography.cjs"),t=require("./Chart.const.cjs"),j=require("./Chart.utils.cjs"),E=l=>{const{data:a,height:c=t.CHART.DEFAULT_HEIGHT,showLabels:u=!0,showValues:i=!0,animated:h=!0,color:d,className:C,id:g,testId:m,...x}=l,B=_.useBearId("FunnelChart"),p=N.resolveBearId(g,B),I=Math.max(...a.map(e=>e.value),n.ONE),q={"--Bear-Chart-height":`${c}px`};return r.jsx(o.Flex,{id:p,"data-testid":m,direction:"column",gap:1,justify:"center",className:s.cn("Bear-Chart Bear-Chart--funnel",C),style:q,...x,children:a.map((e,y)=>{const T={"--Bear-Chart-size":`${Math.max(e.value/I*t.CHART.VIEWBOX,t.CHART.FUNNEL_MIN_WIDTH)}%`,"--Bear-Chart-step-height":`${t.CHART.VIEWBOX/Math.max(a.length,n.ONE)/2}%`,"--Bear-Chart-color":j.getChartColor(y,e.color||d)};return r.jsxs(o.Flex,{direction:"column",align:"center",gap:1,className:"bear-w-full",children:[r.jsx(b.Box,{className:s.cn("Bear-Chart__funnel-step bear-rounded-md",h&&"animate-grow-right"),style:T}),u&&r.jsxs(F.Typography,{variant:"caption",color:"muted",children:[e.label,i?` · ${e.value}`:""]})]},e.label)})})};exports.FunnelChart=E;
@@ -1,51 +1,53 @@
1
- import { jsx as o, jsxs as e } from "react/jsx-runtime";
1
+ import { jsx as a, jsxs as o } from "react/jsx-runtime";
2
2
  import { ONE as l } from "../../constants/numbers.const.js";
3
3
  import { cn as n } from "../../utils/cn.js";
4
4
  import "react";
5
- import { Box as b } from "../Box/Box.js";
6
- import { Flex as m } from "../Flex/Flex.js";
7
- import { Typography as w } from "../Typography/Typography.js";
8
- import { CHART as a } from "./Chart.const.js";
9
- import { getChartColor as E } from "./Chart.utils.js";
10
- const L = (c) => {
5
+ import { resolveBearId as E } from "../../utils/generateBearId.utils.js";
6
+ import { useBearId as b } from "../../utils/useBearId.js";
7
+ import { Box as v } from "../Box/Box.js";
8
+ import { Flex as s } from "../Flex/Flex.js";
9
+ import { Typography as F } from "../Typography/Typography.js";
10
+ import { CHART as t } from "./Chart.const.js";
11
+ import { getChartColor as T } from "./Chart.utils.js";
12
+ const S = (m) => {
11
13
  const {
12
- data: t,
13
- height: i = a.DEFAULT_HEIGHT,
14
- showLabels: s = !0,
14
+ data: e,
15
+ height: i = t.DEFAULT_HEIGHT,
16
+ showLabels: c = !0,
15
17
  showValues: h = !0,
16
- animated: u = !0,
18
+ animated: d = !0,
17
19
  color: p,
18
- className: d,
19
- ...f
20
- } = c, g = Math.max(...t.map((r) => r.value), l);
21
- return /* @__PURE__ */ o(
22
- m,
20
+ className: u,
21
+ id: f,
22
+ testId: g,
23
+ ...B
24
+ } = m, C = b("FunnelChart"), x = E(f, C), I = Math.max(...e.map((r) => r.value), l), N = { "--Bear-Chart-height": `${i}px` };
25
+ return /* @__PURE__ */ a(
26
+ s,
23
27
  {
28
+ id: x,
29
+ "data-testid": g,
24
30
  direction: "column",
25
31
  gap: 1,
26
32
  justify: "center",
27
- className: n("Bear-Chart Bear-Chart--funnel bear-w-full", d),
28
- style: { height: i },
29
- ...f,
30
- children: t.map((r, N) => {
31
- const x = Math.max(r.value / g * a.VIEWBOX, a.FUNNEL_MIN_WIDTH), C = E(N, r.color || p);
32
- return /* @__PURE__ */ e(m, { direction: "column", align: "center", gap: 1, className: "bear-w-full", children: [
33
- /* @__PURE__ */ o(
34
- b,
33
+ className: n("Bear-Chart Bear-Chart--funnel", u),
34
+ style: N,
35
+ ...B,
36
+ children: e.map((r, y) => {
37
+ const w = {
38
+ "--Bear-Chart-size": `${Math.max(r.value / I * t.VIEWBOX, t.FUNNEL_MIN_WIDTH)}%`,
39
+ "--Bear-Chart-step-height": `${t.VIEWBOX / Math.max(e.length, l) / 2}%`,
40
+ "--Bear-Chart-color": T(y, r.color || p)
41
+ };
42
+ return /* @__PURE__ */ o(s, { direction: "column", align: "center", gap: 1, className: "bear-w-full", children: [
43
+ /* @__PURE__ */ a(
44
+ v,
35
45
  {
36
- className: n(
37
- "Bear-Chart__funnel-step bear-rounded-md",
38
- u && "animate-grow-right"
39
- ),
40
- style: {
41
- width: `${x}%`,
42
- height: `${a.VIEWBOX / Math.max(t.length, l) / 2}%`,
43
- minHeight: a.FUNNEL_MIN_WIDTH,
44
- backgroundColor: C
45
- }
46
+ className: n("Bear-Chart__funnel-step bear-rounded-md", d && "animate-grow-right"),
47
+ style: w
46
48
  }
47
49
  ),
48
- s && /* @__PURE__ */ e(w, { variant: "caption", color: "muted", children: [
50
+ c && /* @__PURE__ */ o(F, { variant: "caption", color: "muted", children: [
49
51
  r.label,
50
52
  h ? ` · ${r.value}` : ""
51
53
  ] })
@@ -55,5 +57,5 @@ const L = (c) => {
55
57
  );
56
58
  };
57
59
  export {
58
- L as FunnelChart
60
+ S as FunnelChart
59
61
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("../../constants/numbers.const.cjs"),r=require("../../utils/cn.cjs");require("react");const a=require("./Chart.const.cjs"),m=require("./Chart.utils.cjs"),E=p=>{const{data:l,height:x=a.CHART.DEFAULT_HEIGHT,showLabels:b=!0,showDots:f=!0,smooth:T=!0,fill:C=!1,stepped:d=!1,strokeWidth:j=a.CHART.DEFAULT_STROKE_WIDTH,color:t="var(--bear-primary-500, #ec4899)",animated:n=!0,className:y,...R}=p,i=m.calculateLinePoints(l),h=m.generateLinePath(i,T&&!d,d),A=i.length===c.ZERO?"":`${h} L ${a.CHART.VIEWBOX},${a.CHART.VIEWBOX} L 0,${a.CHART.VIEWBOX} Z`;return e.jsxs("div",{className:r.cn("Bear-Chart Bear-Chart--line bear-w-full",y),style:{height:x},...R,children:[e.jsxs("svg",{viewBox:`0 0 ${a.CHART.VIEWBOX} ${a.CHART.VIEWBOX}`,preserveAspectRatio:"none",className:"bear-h-full bear-w-full",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"line-gradient",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:t,stopOpacity:"0.3"}),e.jsx("stop",{offset:"100%",stopColor:t,stopOpacity:"0"})]})}),C&&e.jsx("path",{d:A,fill:"url(#line-gradient)",className:r.cn(n&&"animate-fade-in")}),e.jsx("path",{d:h,fill:"none",stroke:t,strokeWidth:j/c.TEN,strokeLinecap:"round",strokeLinejoin:"round",className:r.cn(n&&"animate-draw-line")}),f&&i.map((s,o)=>{var u;return e.jsx("circle",{cx:s.x,cy:s.y,r:a.CHART.DOT_RADIUS,fill:t,className:r.cn(n&&"animate-scale-in"),style:{animationDelay:`${o*c.FIFTY}ms`}},((u=l[o])==null?void 0:u.label)??o)})]}),b&&e.jsx("div",{className:"bear-mt-2 bear-flex bear-justify-between",children:l.map(s=>e.jsx("span",{className:"bear-text-xs bear-text-gray-600 dark:bear-text-slate-300",children:s.label},s.label))})]})};exports.LineChart=E;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),c=require("../../constants/numbers.const.cjs"),r=require("../../utils/cn.cjs");require("react");const O=require("../../utils/generateBearId.utils.cjs"),b=require("../../utils/useBearId.cjs"),t=require("./Chart.const.cjs"),C=require("./Chart.utils.cjs"),$=I=>{const{data:n,height:T=t.CHART.DEFAULT_HEIGHT,showLabels:x=!0,showDots:B=!0,smooth:j=!0,fill:_=!1,stepped:d=!1,strokeWidth:f=t.CHART.DEFAULT_STROKE_WIDTH,color:a="var(--bear-primary-500, #ec4899)",animated:i=!0,className:y,id:R,testId:g,...A}=I,L=b.useBearId("LineChart"),h=O.resolveBearId(R,L),u=`${h}-gradient`,o=C.calculateLinePoints(n),p=C.generateLinePath(o,j&&!d,d),E=o.length===c.ZERO?"":`${p} L ${t.CHART.VIEWBOX},${t.CHART.VIEWBOX} L 0,${t.CHART.VIEWBOX} Z`,H={"--Bear-Chart-height":`${T}px`};return e.jsxs("div",{id:h,"data-testid":g,className:r.cn("Bear-Chart Bear-Chart--line",y),style:H,...A,children:[e.jsxs("svg",{viewBox:`0 0 ${t.CHART.VIEWBOX} ${t.CHART.VIEWBOX}`,preserveAspectRatio:"none",className:"Bear-Chart__svg",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:u,x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[e.jsx("stop",{offset:"0%",stopColor:a,stopOpacity:"0.3"}),e.jsx("stop",{offset:"100%",stopColor:a,stopOpacity:"0"})]})}),_&&e.jsx("path",{d:E,fill:`url(#${u})`,className:r.cn(i&&"animate-fade-in")}),e.jsx("path",{d:p,fill:"none",stroke:a,strokeWidth:f/c.TEN,strokeLinecap:"round",strokeLinejoin:"round",className:r.cn(i&&"animate-draw-line")}),B&&o.map((s,l)=>{var m;return e.jsx("circle",{cx:s.x,cy:s.y,r:t.CHART.DOT_RADIUS,fill:a,className:r.cn(i&&"animate-scale-in"),style:{animationDelay:`${l*c.FIFTY}ms`}},((m=n[l])==null?void 0:m.label)??l)})]}),x&&e.jsx("div",{className:"Bear-Chart__labels",children:n.map(s=>e.jsx("span",{className:"Bear-Chart__label",children:s.label},s.label))})]})};exports.LineChart=$;
@@ -1,69 +1,83 @@
1
1
  import { jsxs as c, jsx as e } from "react/jsx-runtime";
2
- import { ZERO as I, TEN as N, FIFTY as T } from "../../constants/numbers.const.js";
2
+ import { ZERO as v, TEN as W, FIFTY as b } from "../../constants/numbers.const.js";
3
3
  import { cn as s } from "../../utils/cn.js";
4
4
  import "react";
5
+ import { resolveBearId as x } from "../../utils/generateBearId.utils.js";
6
+ import { useBearId as k } from "../../utils/useBearId.js";
5
7
  import { CHART as a } from "./Chart.const.js";
6
- import { calculateLinePoints as B, generateLinePath as W } from "./Chart.utils.js";
7
- const A = (f) => {
8
+ import { calculateLinePoints as A, generateLinePath as R } from "./Chart.utils.js";
9
+ const G = (I) => {
8
10
  const {
9
- data: l,
10
- height: h = a.DEFAULT_HEIGHT,
11
- showLabels: b = !0,
12
- showDots: u = !0,
13
- smooth: y = !0,
14
- fill: x = !1,
15
- stepped: m = !1,
16
- strokeWidth: E = a.DEFAULT_STROKE_WIDTH,
11
+ data: o,
12
+ height: B = a.DEFAULT_HEIGHT,
13
+ showLabels: y = !0,
14
+ showDots: C = !0,
15
+ smooth: E = !0,
16
+ fill: L = !1,
17
+ stepped: d = !1,
18
+ strokeWidth: u = a.DEFAULT_STROKE_WIDTH,
17
19
  color: r = "var(--bear-primary-500, #ec4899)",
18
- animated: o = !0,
19
- className: L,
20
- ...O
21
- } = f, i = B(l), p = W(i, y && !m, m), D = i.length === I ? "" : `${p} L ${a.VIEWBOX},${a.VIEWBOX} L 0,${a.VIEWBOX} Z`;
22
- return /* @__PURE__ */ c("div", { className: s("Bear-Chart Bear-Chart--line bear-w-full", L), style: { height: h }, ...O, children: [
23
- /* @__PURE__ */ c("svg", { viewBox: `0 0 ${a.VIEWBOX} ${a.VIEWBOX}`, preserveAspectRatio: "none", className: "bear-h-full bear-w-full", children: [
24
- /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ c("linearGradient", { id: "line-gradient", x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
25
- /* @__PURE__ */ e("stop", { offset: "0%", stopColor: r, stopOpacity: "0.3" }),
26
- /* @__PURE__ */ e("stop", { offset: "100%", stopColor: r, stopOpacity: "0" })
27
- ] }) }),
28
- x && /* @__PURE__ */ e(
29
- "path",
30
- {
31
- d: D,
32
- fill: "url(#line-gradient)",
33
- className: s(o && "animate-fade-in")
34
- }
35
- ),
36
- /* @__PURE__ */ e(
37
- "path",
38
- {
39
- d: p,
40
- fill: "none",
41
- stroke: r,
42
- strokeWidth: E / N,
43
- strokeLinecap: "round",
44
- strokeLinejoin: "round",
45
- className: s(o && "animate-draw-line")
46
- }
47
- ),
48
- u && i.map((t, n) => {
49
- var d;
50
- return /* @__PURE__ */ e(
51
- "circle",
52
- {
53
- cx: t.x,
54
- cy: t.y,
55
- r: a.DOT_RADIUS,
56
- fill: r,
57
- className: s(o && "animate-scale-in"),
58
- style: { animationDelay: `${n * T}ms` }
59
- },
60
- ((d = l[n]) == null ? void 0 : d.label) ?? n
61
- );
62
- })
63
- ] }),
64
- b && /* @__PURE__ */ e("div", { className: "bear-mt-2 bear-flex bear-justify-between", children: l.map((t) => /* @__PURE__ */ e("span", { className: "bear-text-xs bear-text-gray-600 dark:bear-text-slate-300", children: t.label }, t.label)) })
65
- ] });
20
+ animated: i = !0,
21
+ className: O,
22
+ id: _,
23
+ testId: $,
24
+ ...g
25
+ } = I, D = k("LineChart"), m = x(_, D), p = `${m}-gradient`, l = A(o), h = R(l, E && !d, d), N = l.length === v ? "" : `${h} L ${a.VIEWBOX},${a.VIEWBOX} L 0,${a.VIEWBOX} Z`, T = { "--Bear-Chart-height": `${B}px` };
26
+ return /* @__PURE__ */ c(
27
+ "div",
28
+ {
29
+ id: m,
30
+ "data-testid": $,
31
+ className: s("Bear-Chart Bear-Chart--line", O),
32
+ style: T,
33
+ ...g,
34
+ children: [
35
+ /* @__PURE__ */ c("svg", { viewBox: `0 0 ${a.VIEWBOX} ${a.VIEWBOX}`, preserveAspectRatio: "none", className: "Bear-Chart__svg", children: [
36
+ /* @__PURE__ */ e("defs", { children: /* @__PURE__ */ c("linearGradient", { id: p, x1: "0%", y1: "0%", x2: "0%", y2: "100%", children: [
37
+ /* @__PURE__ */ e("stop", { offset: "0%", stopColor: r, stopOpacity: "0.3" }),
38
+ /* @__PURE__ */ e("stop", { offset: "100%", stopColor: r, stopOpacity: "0" })
39
+ ] }) }),
40
+ L && /* @__PURE__ */ e(
41
+ "path",
42
+ {
43
+ d: N,
44
+ fill: `url(#${p})`,
45
+ className: s(i && "animate-fade-in")
46
+ }
47
+ ),
48
+ /* @__PURE__ */ e(
49
+ "path",
50
+ {
51
+ d: h,
52
+ fill: "none",
53
+ stroke: r,
54
+ strokeWidth: u / W,
55
+ strokeLinecap: "round",
56
+ strokeLinejoin: "round",
57
+ className: s(i && "animate-draw-line")
58
+ }
59
+ ),
60
+ C && l.map((t, n) => {
61
+ var f;
62
+ return /* @__PURE__ */ e(
63
+ "circle",
64
+ {
65
+ cx: t.x,
66
+ cy: t.y,
67
+ r: a.DOT_RADIUS,
68
+ fill: r,
69
+ className: s(i && "animate-scale-in"),
70
+ style: { animationDelay: `${n * b}ms` }
71
+ },
72
+ ((f = o[n]) == null ? void 0 : f.label) ?? n
73
+ );
74
+ })
75
+ ] }),
76
+ y && /* @__PURE__ */ e("div", { className: "Bear-Chart__labels", children: o.map((t) => /* @__PURE__ */ e("span", { className: "Bear-Chart__label", children: t.label }, t.label)) })
77
+ ]
78
+ }
79
+ );
66
80
  };
67
81
  export {
68
- A as LineChart
82
+ G as LineChart
69
83
  };
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const t=require("react/jsx-runtime"),k=require("react"),d=require("../../constants/numbers.const.cjs"),j=require("../../utils/cn.cjs"),Y=require("../Portal/Portal.cjs"),g=require("../Card/Card.cjs"),b=require("../Flex/Flex.cjs"),w=require("../Box/Box.cjs"),N=require("../Typography/Typography.cjs"),a=require("./Chart.const.cjs"),R=require("./Chart.utils.cjs"),z=f=>{const{data:n,height:C=a.CHART.DEFAULT_HEIGHT,showLabels:P=!0,innerRadius:B=d.ZERO,startAngle:D,padAngle:x=a.CHART.DEFAULT_PAD_ANGLE,animated:F=!0,pieView:_=a.PIE_VIEW_FULL,explodeIndex:S,legendPosition:y="right",onSliceClick:u,onSliceHover:i,showSliceTooltip:m=!0,sliceTooltipTitle:A,sliceTooltipDescription:E,sliceTooltipContent:p,className:M,...q}=f,h=n.reduce((e,r)=>e+r.value,d.ZERO),[s,H]=k.useState(null),I=_===a.PIE_VIEW_HALF,O=_===a.PIE_VIEW_ROSE,L=I?a.CHART.HALF_SWEEP:a.CHART.FULL_SWEEP,U=D??(I?a.CHART.HALF_PIE_START:a.CHART.DEFAULT_START_ANGLE),V=Math.max(...n.map(e=>e.value),d.ONE),W=y===a.CHART_LEGEND_NONE||!P,X=y===a.CHART_LEGEND_BOTTOM,v=(e,r,c)=>{const o=n[c];if(i==null||i(o,c),!m)return;const l=Math.round(o.value/h*a.CHART.VIEWBOX);H({x:e,y:r,index:c,label:o.label,value:o.value,pct:l})},$=()=>{H(null),i==null||i(null,null)};let T=U;const G=n.map((e,r)=>{const c=O?L/n.length-x:e.value/h*L-x,o=T,l=T+c;T+=c+x;const Z=O?a.CHART.ROSE_MIN_RADIUS+e.value/V*(a.CHART.OUTER_RADIUS-a.CHART.ROSE_MIN_RADIUS):a.CHART.OUTER_RADIUS;return{startAngle:o,endAngle:l,color:R.getChartColor(r,e.color),outerRadius:Z,...e}});return t.jsxs(b.Flex,{direction:X?"column":"row",align:"center",gap:4,wrap:"wrap",className:j.cn("Bear-Chart Bear-Chart--pie bear-relative bear-max-w-full",M),...q,children:[t.jsx(w.Box,{style:{width:C,height:C},className:"bear-min-w-0 bear-shrink-0",children:t.jsx("svg",{viewBox:`0 0 ${a.CHART.VIEWBOX} ${a.CHART.VIEWBOX}`,className:"bear-h-full bear-w-full",children:G.map((e,r)=>{const c=(e.startAngle+e.endAngle)/2,o=S===r?R.polarOffset(c,a.CHART.EXPLODE_OFFSET):{x:d.ZERO,y:d.ZERO};return t.jsx("g",{transform:`translate(${o.x} ${o.y})`,children:t.jsx("path",{d:R.createArcPath(e.startAngle,e.endAngle,B,e.outerRadius),fill:e.color,className:j.cn(u&&"bear-cursor-pointer","bear-transition-opacity hover:bear-opacity-80",F&&"animate-scale-in"),style:{animationDelay:`${r*a.CHART.SLICE_DELAY_MS}ms`},onClick:()=>u==null?void 0:u(n[r],r),tabIndex:0,role:"button","aria-label":`${n[r].label} ${Math.round(n[r].value/h*a.CHART.VIEWBOX)}%`,onKeyDown:l=>{(l.key==="Enter"||l.key===" ")&&(l.preventDefault(),u==null||u(n[r],r))},onMouseEnter:l=>v(l.clientX,l.clientY,r),onMouseMove:l=>v(l.clientX,l.clientY,r),onMouseLeave:$})},e.label)})})}),!W&&t.jsx(b.Flex,{direction:"column",gap:2,children:n.map((e,r)=>t.jsxs(b.Flex,{align:"center",gap:2,children:[t.jsx(w.Box,{className:"bear-h-3 bear-w-3 bear-rounded-full",style:{backgroundColor:R.getChartColor(r,e.color)}}),t.jsx(N.Typography,{variant:"body2",color:"muted",children:e.label}),t.jsxs(N.Typography,{variant:"body2",color:"muted",children:[Math.round(e.value/h*a.CHART.VIEWBOX),"%"]})]},e.label))}),s&&m&&t.jsx(Y.Portal,{children:t.jsx("div",{className:"pointer-events-none fixed z-[11500] w-56 max-w-[calc(100vw-24px)]",style:{left:s.x+12,top:s.y+12},children:t.jsxs(g.Card,{variant:"elevated",padding:"none",children:[(A||E)&&t.jsx(g.CardHeader,{title:(A==null?void 0:A(n[s.index],s.index))??s.label,subtitle:E==null?void 0:E(n[s.index],s.index)}),t.jsx(g.CardBody,{className:"bear-text-xs bear-text-gray-500 dark:bear-text-slate-400",children:(p==null?void 0:p(n[s.index],s.index))??t.jsxs("span",{children:[s.value," (",s.pct,"%)"]})})]})})})]})};exports.PieChart=z;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),J=require("react"),d=require("../../constants/numbers.const.cjs"),_=require("../../utils/cn.cjs"),Q=require("../../utils/generateBearId.utils.cjs"),ee=require("../../utils/useBearId.cjs"),te=require("../Portal/Portal.cjs"),T=require("../Card/Card.cjs"),p=require("../Flex/Flex.cjs"),w=require("../Box/Box.cjs"),D=require("../Typography/Typography.cjs"),t=require("./Chart.const.cjs"),R=require("./Chart.utils.cjs"),ae=S=>{const{data:s,height:y=t.CHART.DEFAULT_HEIGHT,showLabels:f=!0,innerRadius:q=d.ZERO,startAngle:M,padAngle:x=t.CHART.DEFAULT_PAD_ANGLE,animated:U=!0,pieView:I=t.PIE_VIEW_FULL,explodeIndex:V,legendPosition:B="right",onSliceClick:i,onSliceHover:u,showSliceTooltip:m=!0,sliceTooltipTitle:A,sliceTooltipDescription:E,sliceTooltipContent:C,className:O,id:W,testId:b,...H}=S,$=ee.useBearId("PieChart"),v=Q.resolveBearId(W,$),h=s.reduce((e,a)=>e+a.value,d.ZERO),[l,j]=J.useState(null),L=I===t.PIE_VIEW_HALF,N=I===t.PIE_VIEW_ROSE,P=L?t.CHART.HALF_SWEEP:t.CHART.FULL_SWEEP,X=M??(L?t.CHART.HALF_PIE_START:t.CHART.DEFAULT_START_ANGLE),Z=Math.max(...s.map(e=>e.value),d.ONE),G=B===t.CHART_LEGEND_NONE||!f,Y=B===t.CHART_LEGEND_BOTTOM,F=(e,a,c)=>{const o=s[c];if(u==null||u(o,c),!m)return;const n=Math.round(o.value/h*t.CHART.VIEWBOX);j({x:e,y:a,index:c,label:o.label,value:o.value,pct:n})},k=()=>{j(null),u==null||u(null,null)};if(s.length===d.ZERO||h===d.ZERO)return r.jsx(p.Flex,{id:v,"data-testid":b,align:"center",justify:"center",className:_.cn("Bear-Chart Bear-Chart--pie Bear-Chart--empty",O),style:{"--Bear-Chart-height":`${y}px`},...H});let g=X;const z=s.map((e,a)=>{const c=N?P/s.length-x:e.value/h*P-x,o=g,n=g+c;g+=c+x;const K=N?t.CHART.ROSE_MIN_RADIUS+e.value/Z*(t.CHART.OUTER_RADIUS-t.CHART.ROSE_MIN_RADIUS):t.CHART.OUTER_RADIUS;return{startAngle:o,endAngle:n,color:R.getChartColor(a,e.color),outerRadius:K,...e}});return r.jsxs(p.Flex,{id:v,"data-testid":b,direction:Y?"column":"row",align:"center",gap:4,wrap:"wrap",className:_.cn("Bear-Chart Bear-Chart--pie",O),style:{"--Bear-Chart-height":`${y}px`},...H,children:[r.jsx(w.Box,{className:"Bear-Chart__pie-canvas",children:r.jsx("svg",{viewBox:`0 0 ${t.CHART.VIEWBOX} ${t.CHART.VIEWBOX}`,className:"Bear-Chart__svg",children:z.map((e,a)=>{const c=(e.startAngle+e.endAngle)/2,o=V===a?R.polarOffset(c,t.CHART.EXPLODE_OFFSET):{x:d.ZERO,y:d.ZERO};return r.jsx("g",{transform:`translate(${o.x} ${o.y})`,children:r.jsx("path",{d:R.createArcPath(e.startAngle,e.endAngle,q,e.outerRadius),fill:e.color,className:_.cn(i&&"bear-cursor-pointer","bear-transition-opacity hover:bear-opacity-80",U&&"animate-scale-in"),style:{animationDelay:`${a*t.CHART.SLICE_DELAY_MS}ms`},onClick:()=>i==null?void 0:i(s[a],a),tabIndex:0,role:"button","aria-label":`${s[a].label} ${Math.round(s[a].value/h*t.CHART.VIEWBOX)}%`,onKeyDown:n=>{(n.key==="Enter"||n.key===" ")&&(n.preventDefault(),i==null||i(s[a],a))},onMouseEnter:n=>F(n.clientX,n.clientY,a),onMouseMove:n=>F(n.clientX,n.clientY,a),onMouseLeave:k})},e.label)})})}),!G&&r.jsx(p.Flex,{direction:"column",gap:2,children:s.map((e,a)=>r.jsxs(p.Flex,{align:"center",gap:2,children:[r.jsx(w.Box,{className:"Bear-Chart__swatch",style:{"--Bear-Chart-color":R.getChartColor(a,e.color)}}),r.jsx(D.Typography,{variant:"body2",color:"muted",children:e.label}),r.jsxs(D.Typography,{variant:"body2",color:"muted",children:[Math.round(e.value/h*t.CHART.VIEWBOX),"%"]})]},e.label))}),l&&m&&r.jsx(te.Portal,{children:r.jsx("div",{className:"pointer-events-none fixed z-[11500] w-56 max-w-[calc(100vw-24px)]",style:{left:l.x+12,top:l.y+12},children:r.jsxs(T.Card,{variant:"elevated",padding:"none",children:[(A||E)&&r.jsx(T.CardHeader,{title:(A==null?void 0:A(s[l.index],l.index))??l.label,subtitle:E==null?void 0:E(s[l.index],l.index)}),r.jsx(T.CardBody,{className:"bear-text-xs bear-text-gray-500 dark:bear-text-slate-400",children:(C==null?void 0:C(s[l.index],l.index))??r.jsxs("span",{children:[l.value," (",l.pct,"%)"]})})]})})})]})};exports.PieChart=ae;