@tetrascience-npm/tetrascience-react-ui 0.7.0-beta.107.1 → 0.7.0-beta.128.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (431) hide show
  1. package/README.md +2 -2
  2. package/dist/components/ai/chain-of-thought.cjs +1 -1
  3. package/dist/components/ai/chain-of-thought.cjs.map +1 -1
  4. package/dist/components/ai/chain-of-thought.js +1 -1
  5. package/dist/components/ai/chain-of-thought.js.map +1 -1
  6. package/dist/components/ai/confirmation.cjs +1 -1
  7. package/dist/components/ai/confirmation.cjs.map +1 -1
  8. package/dist/components/ai/confirmation.js +1 -1
  9. package/dist/components/ai/confirmation.js.map +1 -1
  10. package/dist/components/ai/context.cjs +1 -1
  11. package/dist/components/ai/context.cjs.map +1 -1
  12. package/dist/components/ai/context.js +36 -35
  13. package/dist/components/ai/context.js.map +1 -1
  14. package/dist/components/ai/message.cjs +1 -1
  15. package/dist/components/ai/message.cjs.map +1 -1
  16. package/dist/components/ai/message.js +68 -68
  17. package/dist/components/ai/message.js.map +1 -1
  18. package/dist/components/ai/prompt-input.cjs +1 -1
  19. package/dist/components/ai/prompt-input.cjs.map +1 -1
  20. package/dist/components/ai/prompt-input.js +4 -2
  21. package/dist/components/ai/prompt-input.js.map +1 -1
  22. package/dist/components/ai/queue.cjs +1 -1
  23. package/dist/components/ai/queue.cjs.map +1 -1
  24. package/dist/components/ai/queue.js +9 -9
  25. package/dist/components/ai/queue.js.map +1 -1
  26. package/dist/components/ai/reasoning.cjs +1 -1
  27. package/dist/components/ai/reasoning.cjs.map +1 -1
  28. package/dist/components/ai/reasoning.js +67 -67
  29. package/dist/components/ai/reasoning.js.map +1 -1
  30. package/dist/components/ai/stream-status.cjs +1 -1
  31. package/dist/components/ai/stream-status.cjs.map +1 -1
  32. package/dist/components/ai/stream-status.js +41 -39
  33. package/dist/components/ai/stream-status.js.map +1 -1
  34. package/dist/components/ai/streamdown-code-plugin.cjs +2 -0
  35. package/dist/components/ai/streamdown-code-plugin.cjs.map +1 -0
  36. package/dist/components/ai/streamdown-code-plugin.js +42 -0
  37. package/dist/components/ai/streamdown-code-plugin.js.map +1 -0
  38. package/dist/components/ai/streamdown-plugins.cjs +2 -0
  39. package/dist/components/ai/streamdown-plugins.cjs.map +1 -0
  40. package/dist/components/ai/streamdown-plugins.js +14 -0
  41. package/dist/components/ai/streamdown-plugins.js.map +1 -0
  42. package/dist/components/ai/task.cjs +1 -1
  43. package/dist/components/ai/task.cjs.map +1 -1
  44. package/dist/components/ai/task.js +18 -11
  45. package/dist/components/ai/task.js.map +1 -1
  46. package/dist/components/ai/tool.cjs +1 -1
  47. package/dist/components/ai/tool.cjs.map +1 -1
  48. package/dist/components/ai/tool.js +51 -55
  49. package/dist/components/ai/tool.js.map +1 -1
  50. package/dist/components/ai/use-streamdown-plugins.cjs +2 -0
  51. package/dist/components/ai/use-streamdown-plugins.cjs.map +1 -0
  52. package/dist/components/ai/use-streamdown-plugins.js +25 -0
  53. package/dist/components/ai/use-streamdown-plugins.js.map +1 -0
  54. package/dist/components/charts/AreaPlot/AreaPlot.cjs +2 -0
  55. package/dist/components/charts/AreaPlot/AreaPlot.cjs.map +1 -0
  56. package/dist/components/charts/AreaPlot/AreaPlot.js +270 -0
  57. package/dist/components/charts/AreaPlot/AreaPlot.js.map +1 -0
  58. package/dist/components/charts/BarChart/BarChart.cjs +2 -0
  59. package/dist/components/charts/BarChart/BarChart.cjs.map +1 -0
  60. package/dist/components/charts/BarChart/BarChart.js +219 -0
  61. package/dist/components/charts/BarChart/BarChart.js.map +1 -0
  62. package/dist/components/charts/BoxPlot/BoxPlot.cjs +2 -0
  63. package/dist/components/charts/BoxPlot/BoxPlot.cjs.map +1 -0
  64. package/dist/components/charts/{Boxplot/Boxplot.js → BoxPlot/BoxPlot.js} +78 -79
  65. package/dist/components/charts/BoxPlot/BoxPlot.js.map +1 -0
  66. package/dist/components/charts/ChartTooltip/ChartTooltip.cjs +1 -1
  67. package/dist/components/charts/ChartTooltip/ChartTooltip.cjs.map +1 -1
  68. package/dist/components/charts/ChartTooltip/ChartTooltip.js +22 -22
  69. package/dist/components/charts/ChartTooltip/ChartTooltip.js.map +1 -1
  70. package/dist/components/charts/Chromatogram/Chromatogram.cjs +1 -1
  71. package/dist/components/charts/Chromatogram/Chromatogram.cjs.map +1 -1
  72. package/dist/components/charts/Chromatogram/Chromatogram.js +232 -170
  73. package/dist/components/charts/Chromatogram/Chromatogram.js.map +1 -1
  74. package/dist/components/charts/Chromatogram/annotations.cjs +2 -0
  75. package/dist/components/charts/Chromatogram/annotations.cjs.map +1 -0
  76. package/dist/components/charts/Chromatogram/annotations.js +137 -0
  77. package/dist/components/charts/Chromatogram/annotations.js.map +1 -0
  78. package/dist/components/charts/Chromatogram/boundaryMarkers.cjs +2 -0
  79. package/dist/components/charts/Chromatogram/boundaryMarkers.cjs.map +1 -0
  80. package/dist/components/charts/Chromatogram/boundaryMarkers.js +34 -0
  81. package/dist/components/charts/Chromatogram/boundaryMarkers.js.map +1 -0
  82. package/dist/components/charts/{ChromatogramChart → Chromatogram}/constants.cjs +1 -1
  83. package/dist/components/charts/Chromatogram/constants.cjs.map +1 -0
  84. package/dist/components/charts/{ChromatogramChart → Chromatogram}/constants.js +11 -5
  85. package/dist/components/charts/Chromatogram/constants.js.map +1 -0
  86. package/dist/components/charts/Chromatogram/dataProcessing.cjs +2 -0
  87. package/dist/components/charts/Chromatogram/dataProcessing.cjs.map +1 -0
  88. package/dist/components/charts/Chromatogram/dataProcessing.js +90 -0
  89. package/dist/components/charts/Chromatogram/dataProcessing.js.map +1 -0
  90. package/dist/components/charts/Chromatogram/peakDetection.cjs.map +1 -0
  91. package/dist/components/charts/Chromatogram/peakDetection.js.map +1 -0
  92. package/dist/components/charts/Chromatogram/plotBuilder.cjs +2 -0
  93. package/dist/components/charts/Chromatogram/plotBuilder.cjs.map +1 -0
  94. package/dist/components/charts/Chromatogram/plotBuilder.js +216 -0
  95. package/dist/components/charts/Chromatogram/plotBuilder.js.map +1 -0
  96. package/dist/components/charts/Chromatogram/regionOverlays.cjs +2 -0
  97. package/dist/components/charts/Chromatogram/regionOverlays.cjs.map +1 -0
  98. package/dist/components/charts/Chromatogram/regionOverlays.js +26 -0
  99. package/dist/components/charts/Chromatogram/regionOverlays.js.map +1 -0
  100. package/dist/components/charts/Electropherogram/Electropherogram.cjs +2 -0
  101. package/dist/components/charts/Electropherogram/Electropherogram.cjs.map +1 -0
  102. package/dist/components/charts/Electropherogram/Electropherogram.js +180 -0
  103. package/dist/components/charts/Electropherogram/Electropherogram.js.map +1 -0
  104. package/dist/components/charts/Histogram/Histogram.cjs +1 -1
  105. package/dist/components/charts/Histogram/Histogram.cjs.map +1 -1
  106. package/dist/components/charts/Histogram/Histogram.js +107 -108
  107. package/dist/components/charts/Histogram/Histogram.js.map +1 -1
  108. package/dist/components/charts/LinePlot/LinePlot.cjs +2 -0
  109. package/dist/components/charts/LinePlot/LinePlot.cjs.map +1 -0
  110. package/dist/components/charts/LinePlot/LinePlot.js +224 -0
  111. package/dist/components/charts/LinePlot/LinePlot.js.map +1 -0
  112. package/dist/components/charts/PieChart/PieChart.cjs +1 -1
  113. package/dist/components/charts/PieChart/PieChart.cjs.map +1 -1
  114. package/dist/components/charts/PieChart/PieChart.js +62 -61
  115. package/dist/components/charts/PieChart/PieChart.js.map +1 -1
  116. package/dist/components/charts/PlateMap/PlateMap.cjs +1 -1
  117. package/dist/components/charts/PlateMap/PlateMap.cjs.map +1 -1
  118. package/dist/components/charts/PlateMap/PlateMap.js +246 -242
  119. package/dist/components/charts/PlateMap/PlateMap.js.map +1 -1
  120. package/dist/components/charts/ScatterPlot/ScatterPlot.cjs +2 -0
  121. package/dist/components/charts/ScatterPlot/ScatterPlot.cjs.map +1 -0
  122. package/dist/components/charts/ScatterPlot/ScatterPlot.js +252 -0
  123. package/dist/components/charts/ScatterPlot/ScatterPlot.js.map +1 -0
  124. package/dist/components/charts/ScatterPlotInteractive/ScatterPlotInteractive.cjs +2 -0
  125. package/dist/components/charts/ScatterPlotInteractive/ScatterPlotInteractive.cjs.map +1 -0
  126. package/dist/components/charts/ScatterPlotInteractive/ScatterPlotInteractive.js +215 -0
  127. package/dist/components/charts/ScatterPlotInteractive/ScatterPlotInteractive.js.map +1 -0
  128. package/dist/components/charts/ScatterPlotInteractive/constants.cjs +2 -0
  129. package/dist/components/charts/ScatterPlotInteractive/constants.cjs.map +1 -0
  130. package/dist/components/charts/ScatterPlotInteractive/constants.js +38 -0
  131. package/dist/components/charts/ScatterPlotInteractive/constants.js.map +1 -0
  132. package/dist/components/charts/ScatterPlotInteractive/utils.cjs +2 -0
  133. package/dist/components/charts/ScatterPlotInteractive/utils.cjs.map +1 -0
  134. package/dist/components/charts/ScatterPlotInteractive/utils.js +261 -0
  135. package/dist/components/charts/ScatterPlotInteractive/utils.js.map +1 -0
  136. package/dist/components/charts/StackedChromatogram/StackedChromatogram.cjs +2 -0
  137. package/dist/components/charts/StackedChromatogram/StackedChromatogram.cjs.map +1 -0
  138. package/dist/components/charts/StackedChromatogram/StackedChromatogram.js +40 -0
  139. package/dist/components/charts/StackedChromatogram/StackedChromatogram.js.map +1 -0
  140. package/dist/components/charts/StackedChromatogram/transforms.cjs +2 -0
  141. package/dist/components/charts/StackedChromatogram/transforms.cjs.map +1 -0
  142. package/dist/components/charts/StackedChromatogram/transforms.js +31 -0
  143. package/dist/components/charts/StackedChromatogram/transforms.js.map +1 -0
  144. package/dist/components/charts/plotly-loader.cjs +2 -0
  145. package/dist/components/charts/plotly-loader.cjs.map +1 -0
  146. package/dist/components/charts/plotly-loader.js +22 -0
  147. package/dist/components/charts/plotly-loader.js.map +1 -0
  148. package/dist/components/composed/AssistantLayout/AssistantLayout.cjs +2 -0
  149. package/dist/components/composed/AssistantLayout/AssistantLayout.cjs.map +1 -0
  150. package/dist/components/composed/AssistantLayout/AssistantLayout.js +142 -0
  151. package/dist/components/composed/AssistantLayout/AssistantLayout.js.map +1 -0
  152. package/dist/components/composed/AssistantLayout/dockLayout.cjs +2 -0
  153. package/dist/components/composed/AssistantLayout/dockLayout.cjs.map +1 -0
  154. package/dist/components/composed/AssistantLayout/dockLayout.js +10 -0
  155. package/dist/components/composed/AssistantLayout/dockLayout.js.map +1 -0
  156. package/dist/components/composed/Chat/Chat.cjs +1 -1
  157. package/dist/components/composed/Chat/Chat.cjs.map +1 -1
  158. package/dist/components/composed/Chat/Chat.js +23 -23
  159. package/dist/components/composed/Chat/Chat.js.map +1 -1
  160. package/dist/components/composed/ConfirmDialog/ConfirmDialog.cjs +1 -1
  161. package/dist/components/composed/ConfirmDialog/ConfirmDialog.cjs.map +1 -1
  162. package/dist/components/composed/ConfirmDialog/ConfirmDialog.js +33 -29
  163. package/dist/components/composed/ConfirmDialog/ConfirmDialog.js.map +1 -1
  164. package/dist/components/composed/DataAppShell/CollapseButton.cjs +2 -0
  165. package/dist/components/composed/DataAppShell/CollapseButton.cjs.map +1 -0
  166. package/dist/components/composed/DataAppShell/CollapseButton.js +42 -0
  167. package/dist/components/composed/DataAppShell/CollapseButton.js.map +1 -0
  168. package/dist/components/composed/DataAppShell/DataAppShell.cjs +1 -1
  169. package/dist/components/composed/DataAppShell/DataAppShell.cjs.map +1 -1
  170. package/dist/components/composed/DataAppShell/DataAppShell.js +349 -313
  171. package/dist/components/composed/DataAppShell/DataAppShell.js.map +1 -1
  172. package/dist/components/composed/DataAppShell/PrimaryNav.cjs +2 -0
  173. package/dist/components/composed/DataAppShell/PrimaryNav.cjs.map +1 -0
  174. package/dist/components/composed/DataAppShell/PrimaryNav.js +268 -0
  175. package/dist/components/composed/DataAppShell/PrimaryNav.js.map +1 -0
  176. package/dist/components/composed/DataAppShell/RightPanel.cjs +2 -0
  177. package/dist/components/composed/DataAppShell/RightPanel.cjs.map +1 -0
  178. package/dist/components/composed/DataAppShell/RightPanel.js +282 -0
  179. package/dist/components/composed/DataAppShell/RightPanel.js.map +1 -0
  180. package/dist/components/composed/DataAppShell/SecondaryNav.cjs +2 -0
  181. package/dist/components/composed/DataAppShell/SecondaryNav.cjs.map +1 -0
  182. package/dist/components/composed/DataAppShell/SecondaryNav.js +364 -0
  183. package/dist/components/composed/DataAppShell/SecondaryNav.js.map +1 -0
  184. package/dist/components/composed/DataAppShell/ShellContext.cjs +2 -0
  185. package/dist/components/composed/DataAppShell/ShellContext.cjs.map +1 -0
  186. package/dist/components/composed/DataAppShell/ShellContext.js +23 -0
  187. package/dist/components/composed/DataAppShell/ShellContext.js.map +1 -0
  188. package/dist/components/composed/MoleculeStructure/MoleculeStructure.cjs +2 -0
  189. package/dist/components/composed/MoleculeStructure/MoleculeStructure.cjs.map +1 -0
  190. package/dist/components/composed/MoleculeStructure/MoleculeStructure.js +87 -0
  191. package/dist/components/composed/MoleculeStructure/MoleculeStructure.js.map +1 -0
  192. package/dist/components/composed/MoleculeStructure/rdkit-loader.cjs +2 -0
  193. package/dist/components/composed/MoleculeStructure/rdkit-loader.cjs.map +1 -0
  194. package/dist/components/composed/MoleculeStructure/rdkit-loader.js +89 -0
  195. package/dist/components/composed/MoleculeStructure/rdkit-loader.js.map +1 -0
  196. package/dist/components/composed/MoleculeStructure/use-rdkit.cjs +2 -0
  197. package/dist/components/composed/MoleculeStructure/use-rdkit.cjs.map +1 -0
  198. package/dist/components/composed/MoleculeStructure/use-rdkit.js +19 -0
  199. package/dist/components/composed/MoleculeStructure/use-rdkit.js.map +1 -0
  200. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.cjs +1 -1
  201. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.cjs.map +1 -1
  202. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.js +17 -17
  203. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.js.map +1 -1
  204. package/dist/components/composed/PlateMapEditor/PlateMapActionsMenu.cjs +1 -1
  205. package/dist/components/composed/PlateMapEditor/PlateMapActionsMenu.cjs.map +1 -1
  206. package/dist/components/composed/PlateMapEditor/PlateMapActionsMenu.js +33 -33
  207. package/dist/components/composed/PlateMapEditor/PlateMapActionsMenu.js.map +1 -1
  208. package/dist/components/composed/PlateMapEditor/PlateMapPlateSelector.cjs +1 -1
  209. package/dist/components/composed/PlateMapEditor/PlateMapPlateSelector.cjs.map +1 -1
  210. package/dist/components/composed/PlateMapEditor/PlateMapPlateSelector.js +7 -7
  211. package/dist/components/composed/PlateMapEditor/PlateMapPlateSelector.js.map +1 -1
  212. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.cjs +1 -1
  213. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.cjs.map +1 -1
  214. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.js +1 -1
  215. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.js.map +1 -1
  216. package/dist/components/composed/PlateMapEditor/WellLegend.cjs +1 -1
  217. package/dist/components/composed/PlateMapEditor/WellLegend.cjs.map +1 -1
  218. package/dist/components/composed/PlateMapEditor/WellLegend.js +24 -12
  219. package/dist/components/composed/PlateMapEditor/WellLegend.js.map +1 -1
  220. package/dist/components/composed/PlateMapEditor/WellManifestTable.cjs +1 -1
  221. package/dist/components/composed/PlateMapEditor/WellManifestTable.cjs.map +1 -1
  222. package/dist/components/composed/PlateMapEditor/WellManifestTable.js +1 -1
  223. package/dist/components/composed/PlateMapEditor/WellManifestTable.js.map +1 -1
  224. package/dist/components/composed/TdpSearch/components/DefaultFilters.cjs +1 -1
  225. package/dist/components/composed/TdpSearch/components/DefaultFilters.cjs.map +1 -1
  226. package/dist/components/composed/TdpSearch/components/DefaultFilters.js +3 -3
  227. package/dist/components/composed/TdpSearch/components/DefaultFilters.js.map +1 -1
  228. package/dist/components/composed/TopBar/TopBar.cjs +2 -0
  229. package/dist/components/composed/TopBar/TopBar.cjs.map +1 -0
  230. package/dist/components/composed/TopBar/TopBar.js +56 -0
  231. package/dist/components/composed/TopBar/TopBar.js.map +1 -0
  232. package/dist/components/composed/UserMenu/UserMenu.cjs +2 -0
  233. package/dist/components/composed/UserMenu/UserMenu.cjs.map +1 -0
  234. package/dist/components/composed/UserMenu/UserMenu.js +99 -0
  235. package/dist/components/composed/UserMenu/UserMenu.js.map +1 -0
  236. package/dist/components/composed/tdp-link.cjs +1 -1
  237. package/dist/components/composed/tdp-link.cjs.map +1 -1
  238. package/dist/components/composed/tdp-link.js +5 -5
  239. package/dist/components/composed/tdp-link.js.map +1 -1
  240. package/dist/components/ui/alert.cjs +1 -1
  241. package/dist/components/ui/alert.cjs.map +1 -1
  242. package/dist/components/ui/alert.js +12 -12
  243. package/dist/components/ui/alert.js.map +1 -1
  244. package/dist/components/ui/badge.cjs +1 -1
  245. package/dist/components/ui/badge.cjs.map +1 -1
  246. package/dist/components/ui/badge.js +14 -14
  247. package/dist/components/ui/badge.js.map +1 -1
  248. package/dist/components/ui/banner.cjs +1 -1
  249. package/dist/components/ui/banner.cjs.map +1 -1
  250. package/dist/components/ui/banner.js +17 -17
  251. package/dist/components/ui/banner.js.map +1 -1
  252. package/dist/components/ui/button.cjs +1 -1
  253. package/dist/components/ui/button.cjs.map +1 -1
  254. package/dist/components/ui/button.js +16 -16
  255. package/dist/components/ui/button.js.map +1 -1
  256. package/dist/components/ui/calendar.cjs +1 -1
  257. package/dist/components/ui/calendar.cjs.map +1 -1
  258. package/dist/components/ui/calendar.js +3 -3
  259. package/dist/components/ui/calendar.js.map +1 -1
  260. package/dist/components/ui/code-block.cjs +3 -3
  261. package/dist/components/ui/code-block.cjs.map +1 -1
  262. package/dist/components/ui/code-block.js +136 -118
  263. package/dist/components/ui/code-block.js.map +1 -1
  264. package/dist/components/ui/code-editor.cjs +1 -1
  265. package/dist/components/ui/code-editor.cjs.map +1 -1
  266. package/dist/components/ui/code-editor.js +14 -12
  267. package/dist/components/ui/code-editor.js.map +1 -1
  268. package/dist/components/ui/combobox.cjs +1 -1
  269. package/dist/components/ui/combobox.cjs.map +1 -1
  270. package/dist/components/ui/combobox.js +33 -29
  271. package/dist/components/ui/combobox.js.map +1 -1
  272. package/dist/components/ui/command.cjs +1 -1
  273. package/dist/components/ui/command.cjs.map +1 -1
  274. package/dist/components/ui/command.js +81 -77
  275. package/dist/components/ui/command.js.map +1 -1
  276. package/dist/components/ui/context-menu.cjs +1 -1
  277. package/dist/components/ui/context-menu.cjs.map +1 -1
  278. package/dist/components/ui/context-menu.js +13 -13
  279. package/dist/components/ui/context-menu.js.map +1 -1
  280. package/dist/components/ui/data-table/data-table-column-toggle.cjs +1 -1
  281. package/dist/components/ui/data-table/data-table-column-toggle.cjs.map +1 -1
  282. package/dist/components/ui/data-table/data-table-column-toggle.js +70 -62
  283. package/dist/components/ui/data-table/data-table-column-toggle.js.map +1 -1
  284. package/dist/components/ui/data-table/data-table-filter.cjs +1 -1
  285. package/dist/components/ui/data-table/data-table-filter.cjs.map +1 -1
  286. package/dist/components/ui/data-table/data-table-filter.js +24 -23
  287. package/dist/components/ui/data-table/data-table-filter.js.map +1 -1
  288. package/dist/components/ui/data-table/data-table-group.cjs +1 -1
  289. package/dist/components/ui/data-table/data-table-group.cjs.map +1 -1
  290. package/dist/components/ui/data-table/data-table-group.js +17 -16
  291. package/dist/components/ui/data-table/data-table-group.js.map +1 -1
  292. package/dist/components/ui/data-table/data-table-pagination.cjs +1 -1
  293. package/dist/components/ui/data-table/data-table-pagination.cjs.map +1 -1
  294. package/dist/components/ui/data-table/data-table-pagination.js +15 -15
  295. package/dist/components/ui/data-table/data-table-pagination.js.map +1 -1
  296. package/dist/components/ui/data-table/data-table.cjs +1 -1
  297. package/dist/components/ui/data-table/data-table.cjs.map +1 -1
  298. package/dist/components/ui/data-table/data-table.js +191 -190
  299. package/dist/components/ui/data-table/data-table.js.map +1 -1
  300. package/dist/components/ui/dialog.cjs +1 -1
  301. package/dist/components/ui/dialog.cjs.map +1 -1
  302. package/dist/components/ui/dialog.js +1 -1
  303. package/dist/components/ui/dialog.js.map +1 -1
  304. package/dist/components/ui/dropdown-menu.cjs +1 -1
  305. package/dist/components/ui/dropdown-menu.cjs.map +1 -1
  306. package/dist/components/ui/dropdown-menu.js +12 -4
  307. package/dist/components/ui/dropdown-menu.js.map +1 -1
  308. package/dist/components/ui/hover-card.cjs +1 -1
  309. package/dist/components/ui/hover-card.cjs.map +1 -1
  310. package/dist/components/ui/hover-card.js +3 -3
  311. package/dist/components/ui/hover-card.js.map +1 -1
  312. package/dist/components/ui/item.cjs +1 -1
  313. package/dist/components/ui/item.cjs.map +1 -1
  314. package/dist/components/ui/item.js +44 -36
  315. package/dist/components/ui/item.js.map +1 -1
  316. package/dist/components/ui/menubar.cjs +1 -1
  317. package/dist/components/ui/menubar.cjs.map +1 -1
  318. package/dist/components/ui/menubar.js +2 -2
  319. package/dist/components/ui/menubar.js.map +1 -1
  320. package/dist/components/ui/navigation-menu.cjs +1 -1
  321. package/dist/components/ui/navigation-menu.cjs.map +1 -1
  322. package/dist/components/ui/navigation-menu.js +1 -1
  323. package/dist/components/ui/navigation-menu.js.map +1 -1
  324. package/dist/components/ui/popover.cjs +1 -1
  325. package/dist/components/ui/popover.cjs.map +1 -1
  326. package/dist/components/ui/popover.js +1 -1
  327. package/dist/components/ui/popover.js.map +1 -1
  328. package/dist/components/ui/scroll-area.cjs +1 -1
  329. package/dist/components/ui/scroll-area.cjs.map +1 -1
  330. package/dist/components/ui/scroll-area.js +1 -0
  331. package/dist/components/ui/scroll-area.js.map +1 -1
  332. package/dist/components/ui/select.cjs +1 -1
  333. package/dist/components/ui/select.cjs.map +1 -1
  334. package/dist/components/ui/select.js +1 -1
  335. package/dist/components/ui/select.js.map +1 -1
  336. package/dist/components/ui/sheet.cjs +1 -1
  337. package/dist/components/ui/sheet.cjs.map +1 -1
  338. package/dist/components/ui/sheet.js +5 -5
  339. package/dist/components/ui/sheet.js.map +1 -1
  340. package/dist/components/ui/sidebar.cjs +1 -1
  341. package/dist/components/ui/sidebar.cjs.map +1 -1
  342. package/dist/components/ui/sidebar.js +2 -2
  343. package/dist/components/ui/sidebar.js.map +1 -1
  344. package/dist/components/ui/slider.cjs +1 -1
  345. package/dist/components/ui/slider.cjs.map +1 -1
  346. package/dist/components/ui/slider.js +10 -9
  347. package/dist/components/ui/slider.js.map +1 -1
  348. package/dist/components/ui/sonner.cjs +1 -1
  349. package/dist/components/ui/sonner.cjs.map +1 -1
  350. package/dist/components/ui/sonner.js +25 -10
  351. package/dist/components/ui/sonner.js.map +1 -1
  352. package/dist/components/ui/table.cjs +1 -1
  353. package/dist/components/ui/table.cjs.map +1 -1
  354. package/dist/components/ui/table.js +1 -0
  355. package/dist/components/ui/table.js.map +1 -1
  356. package/dist/components/ui/tabs.cjs +1 -1
  357. package/dist/components/ui/tabs.cjs.map +1 -1
  358. package/dist/components/ui/tabs.js +18 -18
  359. package/dist/components/ui/tabs.js.map +1 -1
  360. package/dist/components/ui/tetra-molecule-icon.cjs +2 -0
  361. package/dist/components/ui/tetra-molecule-icon.cjs.map +1 -0
  362. package/dist/components/ui/tetra-molecule-icon.js +49 -0
  363. package/dist/components/ui/tetra-molecule-icon.js.map +1 -0
  364. package/dist/components/ui/toggle-group.cjs +1 -1
  365. package/dist/components/ui/toggle-group.cjs.map +1 -1
  366. package/dist/components/ui/toggle-group.js +35 -31
  367. package/dist/components/ui/toggle-group.js.map +1 -1
  368. package/dist/hooks/use-plotly-theme.cjs +1 -1
  369. package/dist/hooks/use-plotly-theme.cjs.map +1 -1
  370. package/dist/hooks/use-plotly-theme.js +4 -3
  371. package/dist/hooks/use-plotly-theme.js.map +1 -1
  372. package/dist/index.cjs +1 -1
  373. package/dist/index.css +1 -1
  374. package/dist/index.d.ts +1210 -132
  375. package/dist/index.js +694 -639
  376. package/dist/index.js.map +1 -1
  377. package/dist/index.tailwind.css +1 -1
  378. package/dist/lib/shiki.cjs +2 -0
  379. package/dist/lib/shiki.cjs.map +1 -0
  380. package/dist/lib/shiki.js +72 -0
  381. package/dist/lib/shiki.js.map +1 -0
  382. package/package.json +23 -12
  383. package/dist/components/charts/AreaGraph/AreaGraph.cjs +0 -2
  384. package/dist/components/charts/AreaGraph/AreaGraph.cjs.map +0 -1
  385. package/dist/components/charts/AreaGraph/AreaGraph.js +0 -271
  386. package/dist/components/charts/AreaGraph/AreaGraph.js.map +0 -1
  387. package/dist/components/charts/BarGraph/BarGraph.cjs +0 -2
  388. package/dist/components/charts/BarGraph/BarGraph.cjs.map +0 -1
  389. package/dist/components/charts/BarGraph/BarGraph.js +0 -220
  390. package/dist/components/charts/BarGraph/BarGraph.js.map +0 -1
  391. package/dist/components/charts/Boxplot/Boxplot.cjs +0 -2
  392. package/dist/components/charts/Boxplot/Boxplot.cjs.map +0 -1
  393. package/dist/components/charts/Boxplot/Boxplot.js.map +0 -1
  394. package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs +0 -2
  395. package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs.map +0 -1
  396. package/dist/components/charts/ChromatogramChart/ChromatogramChart.js +0 -227
  397. package/dist/components/charts/ChromatogramChart/ChromatogramChart.js.map +0 -1
  398. package/dist/components/charts/ChromatogramChart/annotations.cjs +0 -2
  399. package/dist/components/charts/ChromatogramChart/annotations.cjs.map +0 -1
  400. package/dist/components/charts/ChromatogramChart/annotations.js +0 -73
  401. package/dist/components/charts/ChromatogramChart/annotations.js.map +0 -1
  402. package/dist/components/charts/ChromatogramChart/boundaryMarkers.cjs +0 -2
  403. package/dist/components/charts/ChromatogramChart/boundaryMarkers.cjs.map +0 -1
  404. package/dist/components/charts/ChromatogramChart/boundaryMarkers.js +0 -34
  405. package/dist/components/charts/ChromatogramChart/boundaryMarkers.js.map +0 -1
  406. package/dist/components/charts/ChromatogramChart/constants.cjs.map +0 -1
  407. package/dist/components/charts/ChromatogramChart/constants.js.map +0 -1
  408. package/dist/components/charts/ChromatogramChart/dataProcessing.cjs +0 -2
  409. package/dist/components/charts/ChromatogramChart/dataProcessing.cjs.map +0 -1
  410. package/dist/components/charts/ChromatogramChart/dataProcessing.js +0 -79
  411. package/dist/components/charts/ChromatogramChart/dataProcessing.js.map +0 -1
  412. package/dist/components/charts/ChromatogramChart/peakDetection.cjs.map +0 -1
  413. package/dist/components/charts/ChromatogramChart/peakDetection.js.map +0 -1
  414. package/dist/components/charts/DotPlot/DotPlot.cjs +0 -2
  415. package/dist/components/charts/DotPlot/DotPlot.cjs.map +0 -1
  416. package/dist/components/charts/DotPlot/DotPlot.js +0 -208
  417. package/dist/components/charts/DotPlot/DotPlot.js.map +0 -1
  418. package/dist/components/charts/Heatmap/Heatmap.cjs +0 -2
  419. package/dist/components/charts/Heatmap/Heatmap.cjs.map +0 -1
  420. package/dist/components/charts/Heatmap/Heatmap.js +0 -67
  421. package/dist/components/charts/Heatmap/Heatmap.js.map +0 -1
  422. package/dist/components/charts/LineGraph/LineGraph.cjs +0 -2
  423. package/dist/components/charts/LineGraph/LineGraph.cjs.map +0 -1
  424. package/dist/components/charts/LineGraph/LineGraph.js +0 -225
  425. package/dist/components/charts/LineGraph/LineGraph.js.map +0 -1
  426. package/dist/components/charts/ScatterGraph/ScatterGraph.cjs +0 -2
  427. package/dist/components/charts/ScatterGraph/ScatterGraph.cjs.map +0 -1
  428. package/dist/components/charts/ScatterGraph/ScatterGraph.js +0 -234
  429. package/dist/components/charts/ScatterGraph/ScatterGraph.js.map +0 -1
  430. /package/dist/components/charts/{ChromatogramChart → Chromatogram}/peakDetection.cjs +0 -0
  431. /package/dist/components/charts/{ChromatogramChart → Chromatogram}/peakDetection.js +0 -0
@@ -1 +0,0 @@
1
- {"version":3,"file":"BarGraph.cjs","sources":["../../../../src/components/charts/BarGraph/BarGraph.tsx"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\nimport React, { useEffect, useRef, useMemo } from \"react\";\n\nimport { useChartTooltip } from \"../ChartTooltip\";\n\nimport { useElementSize } from \"@/hooks/use-element-size\";\nimport { usePlotlyTheme } from \"@/hooks/use-plotly-theme\";\nimport { cn } from \"@/lib/utils\";\nimport { seriesColor } from \"@/utils/colors\";\n\ninterface BarDataSeries {\n x: number[];\n y: number[];\n name: string;\n /** Optional color override (auto-assigned from CHART_COLORS if not provided) */\n color?: string;\n error_y?: {\n type: \"data\";\n array: number[];\n visible: boolean;\n };\n}\n\ntype BarGraphVariant = \"group\" | \"stack\" | \"overlay\";\n\n/** Top margin reserving room for the 32px title; reduced when no title is set */\nconst TITLE_MARGIN_TOP = 60;\nconst NO_TITLE_MARGIN_TOP = 30;\n\ninterface BarGraphProps {\n dataSeries: BarDataSeries[];\n /**\n * Fixed width in pixels. When omitted, the chart fills its container and\n * tracks the container's width via a `ResizeObserver`.\n */\n width?: number;\n /**\n * Fixed height in pixels. When omitted, the chart fills its container and\n * tracks the container's height via a `ResizeObserver`.\n */\n height?: number;\n xRange?: [number, number];\n yRange?: [number, number];\n variant?: BarGraphVariant;\n xTitle?: string;\n yTitle?: string;\n title?: string;\n barWidth?: number;\n /**\n * Categorical labels for the x-axis ticks. When provided, the x data values\n * still drive bar positioning but the displayed tick labels match these\n * strings in order (e.g. [\"Mon\", \"Tue\", …]). Should align 1:1 with the\n * unique, ordered x values across all series.\n */\n xTickText?: string[];\n}\n\nconst BarGraph: React.FC<BarGraphProps> = ({\n dataSeries,\n width,\n height,\n xRange,\n yRange,\n variant = \"group\",\n xTitle,\n yTitle,\n title,\n barWidth = 24,\n xTickText,\n}) => {\n const plotRef = useRef<HTMLDivElement>(null);\n const theme = usePlotlyTheme();\n const { bindTooltip, tooltipElement } = useChartTooltip({ xLabel: xTitle, yLabel: yTitle });\n\n // Omitted width/height → fill the container and track its measured size;\n // explicit pixel values override. See AreaGraph for the reference pattern.\n const [containerRef, measured] = useElementSize<HTMLDivElement>();\n const resolvedWidth = width ?? measured.width;\n const resolvedHeight = height ?? measured.height;\n const hasSize = resolvedWidth > 0 && resolvedHeight > 0;\n // Fill is per-dimension: omit width to fill the container width, omit height\n // to fill its height (so e.g. a fixed width with a container-driven height works).\n const fillWidth = width === undefined;\n const fillHeight = height === undefined;\n const sizeRef = useRef({ width: resolvedWidth, height: resolvedHeight });\n sizeRef.current = { width: resolvedWidth, height: resolvedHeight };\n const plotInitedRef = useRef(false);\n // Size last applied to the plot, so the resize effect can skip a redundant\n // relayout right after newPlot already drew at that size.\n const appliedSizeRef = useRef({ width: 0, height: 0 });\n\n const { yMin, yMax } = useMemo(() => {\n let minX = Number.MAX_VALUE;\n let maxX = Number.MIN_VALUE;\n let minY = Number.MAX_VALUE;\n let maxY = Number.MIN_VALUE;\n\n dataSeries.forEach((series) => {\n series.x.forEach((x) => {\n minX = Math.min(minX, x);\n maxX = Math.max(maxX, x);\n });\n series.y.forEach((y) => {\n minY = Math.min(minY, y);\n maxY = Math.max(maxY, y);\n });\n });\n\n const xPadding = (maxX - minX) * 0.1;\n const yPadding = (maxY - minY) * 0.1;\n\n return {\n xMin: minX - xPadding,\n xMax: maxX + xPadding,\n yMin: variant === \"stack\" ? 0 : minY - yPadding,\n yMax: maxY + yPadding,\n };\n }, [dataSeries, variant]);\n\n const effectiveYRange = useMemo(\n () => yRange || [yMin, yMax],\n [yRange, yMin, yMax],\n );\n\n const xTicks = useMemo(\n () => [...new Set(dataSeries.flatMap((s) => s.x))].sort((a, b) => a - b),\n [dataSeries],\n );\n\n // Only apply categorical labels when they align 1:1 with the tick positions;\n // a mismatch would silently mis-label ticks, so fall back to numeric ticks.\n const useCategoricalX = !!xTickText && xTickText.length === xTicks.length;\n\n const yTicks = useMemo(() => {\n const range = effectiveYRange[1] - effectiveYRange[0];\n let step = Math.pow(10, Math.floor(Math.log10(range)));\n\n if (range / step > 10) step = step * 2;\n if (range / step < 4) step = step / 2;\n\n const ticks = [];\n let current = Math.ceil(effectiveYRange[0] / step) * step;\n while (current <= effectiveYRange[1]) {\n ticks.push(current);\n current += step;\n }\n return ticks;\n }, [effectiveYRange]);\n\n const barMode = useMemo((): \"group\" | \"stack\" | \"overlay\" => {\n switch (variant) {\n case \"stack\":\n return \"stack\";\n case \"overlay\":\n return \"overlay\";\n case \"group\":\n default:\n return \"group\";\n }\n }, [variant]);\n\n const tickOptions = useMemo(\n () => ({\n tickcolor: theme.tickColor,\n ticklen: 12,\n tickwidth: 1,\n ticks: \"outside\" as const,\n tickfont: {\n size: 16,\n color: theme.textColor,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n linecolor: theme.lineColor,\n linewidth: 1,\n position: 0,\n zeroline: false,\n }),\n [theme],\n );\n\n useEffect(() => {\n if (!plotRef.current || !hasSize) return;\n\n const data = dataSeries.map((series, index) => ({\n x: series.x,\n y: series.y,\n type: \"bar\" as const,\n name: series.name,\n hoverinfo: \"none\" as const,\n marker: {\n color: seriesColor(index, series.color),\n },\n width: barWidth,\n error_y: series.error_y,\n }));\n\n const layout = {\n ...(title\n ? {\n title: {\n text: title,\n font: {\n size: 32,\n family: \"Inter, sans-serif\",\n color: theme.textColor,\n },\n },\n }\n : {}),\n width: sizeRef.current.width,\n height: sizeRef.current.height,\n margin: {\n l: 80,\n r: 30,\n // Reserve room for tick labels, the x-axis title, and the\n // container-anchored bottom legend stacked beneath them.\n b: 96,\n t: title ? TITLE_MARGIN_TOP : NO_TITLE_MARGIN_TOP,\n pad: 0,\n },\n paper_bgcolor: theme.paperBg,\n plot_bgcolor: theme.plotBg,\n font: {\n family: \"Inter, sans-serif\",\n },\n barmode: barMode,\n bargap: 0.15,\n dragmode: false as const,\n xaxis: {\n title: {\n text: xTitle,\n font: {\n size: 16,\n color: theme.textSecondary,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n standoff: 32,\n },\n gridcolor: theme.gridColor,\n range: xRange,\n autorange: !xRange,\n tickmode: \"array\" as const,\n tickvals: xTicks,\n ...(useCategoricalX ? { ticktext: xTickText } : {}),\n showgrid: true,\n // Reserve space for tick labels + the axis title so the bottom legend\n // can't overlap them at small sizes (SW-2157).\n automargin: true,\n ...tickOptions,\n },\n yaxis: {\n title: {\n text: yTitle,\n font: {\n size: 16,\n color: theme.textSecondary,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n standoff: 30,\n },\n gridcolor: theme.gridColor,\n range: yRange,\n autorange: !yRange,\n tickmode: \"array\" as const,\n tickvals: yTicks,\n showgrid: true,\n automargin: true,\n ...tickOptions,\n },\n legend: {\n // Anchor to the bottom of the container (not the plot area) so the\n // legend always clears the x-axis tick labels + title — a paper-relative\n // fractional offset collapses into the ticks at small heights (SW-2157).\n x: 0.5,\n y: 0,\n xanchor: \"center\" as const,\n yanchor: \"bottom\" as const,\n yref: \"container\" as const,\n orientation: \"h\" as const,\n font: {\n size: 16,\n color: theme.legendColor,\n family: \"Inter, sans-serif\",\n weight: 500,\n },\n },\n showlegend: dataSeries.length > 1,\n };\n\n const config = {\n // Sizing is driven from the measured container; disable Plotly's own\n // window-resize responsiveness (it can't see container resizes).\n responsive: false,\n displayModeBar: false,\n displaylogo: false,\n };\n\n Plotly.newPlot(plotRef.current, data, layout, config);\n bindTooltip(plotRef.current);\n\n // Capture ref value for cleanup\n const plotElement = plotRef.current;\n plotInitedRef.current = true;\n appliedSizeRef.current = { ...sizeRef.current };\n\n // Cleanup function\n return () => {\n if (plotElement) {\n Plotly.purge(plotElement);\n plotInitedRef.current = false;\n }\n };\n }, [dataSeries, hasSize, xRange, yRange, xTitle, yTitle, title, barWidth, barMode, tickOptions, xTicks, yTicks, useCategoricalX, xTickText, theme, bindTooltip]);\n\n // Resize in place when the measured/overridden size changes — cheaper than\n // recreating the plot, and it preserves tooltip/event bindings.\n useEffect(() => {\n const plotElement = plotRef.current;\n if (!plotElement || !plotInitedRef.current || resolvedWidth <= 0 || resolvedHeight <= 0) {\n return;\n }\n // newPlot already drew at the current size; skip the redundant relayout\n // (it would queue an automargin redraw that can reject if we unmount first).\n if (\n appliedSizeRef.current.width === resolvedWidth &&\n appliedSizeRef.current.height === resolvedHeight\n ) {\n return;\n }\n appliedSizeRef.current = { width: resolvedWidth, height: resolvedHeight };\n // Swallow rejections from a relayout that races an unmount/purge.\n void Plotly.relayout(plotElement, { width: resolvedWidth, height: resolvedHeight }).catch(\n () => {},\n );\n }, [resolvedWidth, resolvedHeight]);\n\n return (\n <div\n ref={containerRef}\n className={cn(\"bar-graph-container relative\", fillWidth && \"w-full\", fillHeight && \"h-full\")}\n >\n <div ref={plotRef} style={{ width: \"100%\", height: \"100%\" }} />\n {tooltipElement}\n </div>\n );\n};\n\nexport { BarGraph };\nexport type { BarDataSeries, BarGraphVariant, BarGraphProps };\n"],"names":["TITLE_MARGIN_TOP","NO_TITLE_MARGIN_TOP","BarGraph","dataSeries","width","height","xRange","yRange","variant","xTitle","yTitle","title","barWidth","xTickText","plotRef","useRef","theme","usePlotlyTheme","bindTooltip","tooltipElement","useChartTooltip","containerRef","measured","useElementSize","resolvedWidth","resolvedHeight","hasSize","fillWidth","fillHeight","sizeRef","plotInitedRef","appliedSizeRef","yMin","yMax","useMemo","minX","maxX","minY","maxY","series","x","y","xPadding","yPadding","effectiveYRange","xTicks","s","a","b","useCategoricalX","yTicks","range","step","ticks","current","barMode","tickOptions","useEffect","data","index","seriesColor","layout","config","Plotly","plotElement","jsxs","cn","jsx"],"mappings":"+XA0BMA,EAAmB,GACnBC,EAAsB,GA8BtBC,EAAoC,CAAC,CACzC,WAAAC,EACA,MAAAC,EACA,OAAAC,EACA,OAAAC,EACA,OAAAC,EACA,QAAAC,EAAU,QACV,OAAAC,EACA,OAAAC,EACA,MAAAC,EACA,SAAAC,EAAW,GACX,UAAAC,CACF,IAAM,CACJ,MAAMC,EAAUC,EAAAA,OAAuB,IAAI,EACrCC,EAAQC,EAAAA,eAAA,EACR,CAAE,YAAAC,EAAa,eAAAC,CAAA,EAAmBC,EAAAA,gBAAgB,CAAE,OAAQX,EAAQ,OAAQC,EAAQ,EAIpF,CAACW,EAAcC,CAAQ,EAAIC,iBAAA,EAC3BC,EAAgBpB,GAASkB,EAAS,MAClCG,EAAiBpB,GAAUiB,EAAS,OACpCI,EAAUF,EAAgB,GAAKC,EAAiB,EAGhDE,EAAYvB,IAAU,OACtBwB,EAAavB,IAAW,OACxBwB,EAAUd,EAAAA,OAAO,CAAE,MAAOS,EAAe,OAAQC,EAAgB,EACvEI,EAAQ,QAAU,CAAE,MAAO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M,CACPmC,IACFD,EAAO,MAAMC,CAAW,EACxBlC,EAAc,QAAU,GAE5B,CACF,EAAG,CAAC3B,EAAYuB,EAASpB,EAAQC,EAAQE,EAAQC,EAAQC,EAAOC,EAAU2C,EAASC,EAAaX,EAAQK,EAAQD,EAAiBpC,EAAWG,EAAOE,CAAW,CAAC,EAI/JuC,EAAAA,UAAU,IAAM,CACd,MAAMO,EAAclD,EAAQ,QACxB,CAACkD,GAAe,CAAClC,EAAc,SAAWN,GAAiB,GAAKC,GAAkB,GAMpFM,EAAe,QAAQ,QAAUP,GACjCO,EAAe,QAAQ,SAAWN,IAIpCM,EAAe,QAAU,CAAE,MAAOP,EAAe,OAAQC,CAAA,EAEpDsC,EAAO,SAASC,EAAa,CAAE,MAAOxC,EAAe,OAAQC,CAAA,CAAgB,EAAE,MAClF,IAAM,CAAC,CAAA,EAEX,EAAG,CAACD,EAAeC,CAAc,CAAC,EAGhCwC,EAAAA,KAAC,MAAA,CACC,IAAK5C,EACL,UAAW6C,EAAAA,GAAG,+BAAgCvC,GAAa,SAAUC,GAAc,QAAQ,EAE3F,SAAA,CAAAuC,EAAAA,IAAC,MAAA,CAAI,IAAKrD,EAAS,MAAO,CAAE,MAAO,OAAQ,OAAQ,MAAA,CAAO,CAAG,EAC5DK,CAAA,CAAA,CAAA,CAGP"}
@@ -1,220 +0,0 @@
1
- import { jsxs as q, jsx as D } from "react/jsx-runtime";
2
- import z from "plotly.js-dist";
3
- import { useRef as x, useMemo as h, useEffect as Y } from "react";
4
- import { useChartTooltip as F } from "../ChartTooltip/ChartTooltip.js";
5
- import { useElementSize as J } from "../../../hooks/use-element-size.js";
6
- import { usePlotlyTheme as K } from "../../../hooks/use-plotly-theme.js";
7
- import { cn as Q } from "../../../lib/utils.js";
8
- import { seriesColor as S } from "../../../utils/colors.js";
9
- const Z = 60, $ = 30, st = ({
10
- dataSeries: s,
11
- width: C,
12
- height: N,
13
- xRange: k,
14
- yRange: f,
15
- variant: d = "group",
16
- xTitle: b,
17
- yTitle: E,
18
- title: g,
19
- barWidth: A = 24,
20
- xTickText: p
21
- }) => {
22
- const a = x(null), e = K(), { bindTooltip: L, tooltipElement: j } = F({ xLabel: b, yLabel: E }), [H, P] = J(), i = C ?? P.width, c = N ?? P.height, X = i > 0 && c > 0, T = C === void 0, W = N === void 0, y = x({ width: i, height: c });
23
- y.current = { width: i, height: c };
24
- const I = x(!1), w = x({ width: 0, height: 0 }), { yMin: B, yMax: O } = h(() => {
25
- let o = Number.MAX_VALUE, t = Number.MIN_VALUE, n = Number.MAX_VALUE, r = Number.MIN_VALUE;
26
- s.forEach((R) => {
27
- R.x.forEach((m) => {
28
- o = Math.min(o, m), t = Math.max(t, m);
29
- }), R.y.forEach((m) => {
30
- n = Math.min(n, m), r = Math.max(r, m);
31
- });
32
- });
33
- const l = (t - o) * 0.1, M = (r - n) * 0.1;
34
- return {
35
- xMin: o - l,
36
- xMax: t + l,
37
- yMin: d === "stack" ? 0 : n - M,
38
- yMax: r + M
39
- };
40
- }, [s, d]), u = h(
41
- () => f || [B, O],
42
- [f, B, O]
43
- ), _ = h(
44
- () => [...new Set(s.flatMap((o) => o.x))].sort((o, t) => o - t),
45
- [s]
46
- ), U = !!p && p.length === _.length, V = h(() => {
47
- const o = u[1] - u[0];
48
- let t = Math.pow(10, Math.floor(Math.log10(o)));
49
- o / t > 10 && (t = t * 2), o / t < 4 && (t = t / 2);
50
- const n = [];
51
- let r = Math.ceil(u[0] / t) * t;
52
- for (; r <= u[1]; )
53
- n.push(r), r += t;
54
- return n;
55
- }, [u]), G = h(() => {
56
- switch (d) {
57
- case "stack":
58
- return "stack";
59
- case "overlay":
60
- return "overlay";
61
- default:
62
- return "group";
63
- }
64
- }, [d]), v = h(
65
- () => ({
66
- tickcolor: e.tickColor,
67
- ticklen: 12,
68
- tickwidth: 1,
69
- ticks: "outside",
70
- tickfont: {
71
- size: 16,
72
- color: e.textColor,
73
- family: "Inter, sans-serif",
74
- weight: 400
75
- },
76
- linecolor: e.lineColor,
77
- linewidth: 1,
78
- position: 0,
79
- zeroline: !1
80
- }),
81
- [e]
82
- );
83
- return Y(() => {
84
- if (!a.current || !X) return;
85
- const o = s.map((l, M) => ({
86
- x: l.x,
87
- y: l.y,
88
- type: "bar",
89
- name: l.name,
90
- hoverinfo: "none",
91
- marker: {
92
- color: S(M, l.color)
93
- },
94
- width: A,
95
- error_y: l.error_y
96
- })), t = {
97
- ...g ? {
98
- title: {
99
- text: g,
100
- font: {
101
- size: 32,
102
- family: "Inter, sans-serif",
103
- color: e.textColor
104
- }
105
- }
106
- } : {},
107
- width: y.current.width,
108
- height: y.current.height,
109
- margin: {
110
- l: 80,
111
- r: 30,
112
- // Reserve room for tick labels, the x-axis title, and the
113
- // container-anchored bottom legend stacked beneath them.
114
- b: 96,
115
- t: g ? Z : $,
116
- pad: 0
117
- },
118
- paper_bgcolor: e.paperBg,
119
- plot_bgcolor: e.plotBg,
120
- font: {
121
- family: "Inter, sans-serif"
122
- },
123
- barmode: G,
124
- bargap: 0.15,
125
- dragmode: !1,
126
- xaxis: {
127
- title: {
128
- text: b,
129
- font: {
130
- size: 16,
131
- color: e.textSecondary,
132
- family: "Inter, sans-serif",
133
- weight: 400
134
- },
135
- standoff: 32
136
- },
137
- gridcolor: e.gridColor,
138
- range: k,
139
- autorange: !k,
140
- tickmode: "array",
141
- tickvals: _,
142
- ...U ? { ticktext: p } : {},
143
- showgrid: !0,
144
- // Reserve space for tick labels + the axis title so the bottom legend
145
- // can't overlap them at small sizes (SW-2157).
146
- automargin: !0,
147
- ...v
148
- },
149
- yaxis: {
150
- title: {
151
- text: E,
152
- font: {
153
- size: 16,
154
- color: e.textSecondary,
155
- family: "Inter, sans-serif",
156
- weight: 400
157
- },
158
- standoff: 30
159
- },
160
- gridcolor: e.gridColor,
161
- range: f,
162
- autorange: !f,
163
- tickmode: "array",
164
- tickvals: V,
165
- showgrid: !0,
166
- automargin: !0,
167
- ...v
168
- },
169
- legend: {
170
- // Anchor to the bottom of the container (not the plot area) so the
171
- // legend always clears the x-axis tick labels + title — a paper-relative
172
- // fractional offset collapses into the ticks at small heights (SW-2157).
173
- x: 0.5,
174
- y: 0,
175
- xanchor: "center",
176
- yanchor: "bottom",
177
- yref: "container",
178
- orientation: "h",
179
- font: {
180
- size: 16,
181
- color: e.legendColor,
182
- family: "Inter, sans-serif",
183
- weight: 500
184
- }
185
- },
186
- showlegend: s.length > 1
187
- }, n = {
188
- // Sizing is driven from the measured container; disable Plotly's own
189
- // window-resize responsiveness (it can't see container resizes).
190
- responsive: !1,
191
- displayModeBar: !1,
192
- displaylogo: !1
193
- };
194
- z.newPlot(a.current, o, t, n), L(a.current);
195
- const r = a.current;
196
- return I.current = !0, w.current = { ...y.current }, () => {
197
- r && (z.purge(r), I.current = !1);
198
- };
199
- }, [s, X, k, f, b, E, g, A, G, v, _, V, U, p, e, L]), Y(() => {
200
- const o = a.current;
201
- !o || !I.current || i <= 0 || c <= 0 || w.current.width === i && w.current.height === c || (w.current = { width: i, height: c }, z.relayout(o, { width: i, height: c }).catch(
202
- () => {
203
- }
204
- ));
205
- }, [i, c]), /* @__PURE__ */ q(
206
- "div",
207
- {
208
- ref: H,
209
- className: Q("bar-graph-container relative", T && "w-full", W && "h-full"),
210
- children: [
211
- /* @__PURE__ */ D("div", { ref: a, style: { width: "100%", height: "100%" } }),
212
- j
213
- ]
214
- }
215
- );
216
- };
217
- export {
218
- st as BarGraph
219
- };
220
- //# sourceMappingURL=BarGraph.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"BarGraph.js","sources":["../../../../src/components/charts/BarGraph/BarGraph.tsx"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\nimport React, { useEffect, useRef, useMemo } from \"react\";\n\nimport { useChartTooltip } from \"../ChartTooltip\";\n\nimport { useElementSize } from \"@/hooks/use-element-size\";\nimport { usePlotlyTheme } from \"@/hooks/use-plotly-theme\";\nimport { cn } from \"@/lib/utils\";\nimport { seriesColor } from \"@/utils/colors\";\n\ninterface BarDataSeries {\n x: number[];\n y: number[];\n name: string;\n /** Optional color override (auto-assigned from CHART_COLORS if not provided) */\n color?: string;\n error_y?: {\n type: \"data\";\n array: number[];\n visible: boolean;\n };\n}\n\ntype BarGraphVariant = \"group\" | \"stack\" | \"overlay\";\n\n/** Top margin reserving room for the 32px title; reduced when no title is set */\nconst TITLE_MARGIN_TOP = 60;\nconst NO_TITLE_MARGIN_TOP = 30;\n\ninterface BarGraphProps {\n dataSeries: BarDataSeries[];\n /**\n * Fixed width in pixels. When omitted, the chart fills its container and\n * tracks the container's width via a `ResizeObserver`.\n */\n width?: number;\n /**\n * Fixed height in pixels. When omitted, the chart fills its container and\n * tracks the container's height via a `ResizeObserver`.\n */\n height?: number;\n xRange?: [number, number];\n yRange?: [number, number];\n variant?: BarGraphVariant;\n xTitle?: string;\n yTitle?: string;\n title?: string;\n barWidth?: number;\n /**\n * Categorical labels for the x-axis ticks. When provided, the x data values\n * still drive bar positioning but the displayed tick labels match these\n * strings in order (e.g. [\"Mon\", \"Tue\", …]). Should align 1:1 with the\n * unique, ordered x values across all series.\n */\n xTickText?: string[];\n}\n\nconst BarGraph: React.FC<BarGraphProps> = ({\n dataSeries,\n width,\n height,\n xRange,\n yRange,\n variant = \"group\",\n xTitle,\n yTitle,\n title,\n barWidth = 24,\n xTickText,\n}) => {\n const plotRef = useRef<HTMLDivElement>(null);\n const theme = usePlotlyTheme();\n const { bindTooltip, tooltipElement } = useChartTooltip({ xLabel: xTitle, yLabel: yTitle });\n\n // Omitted width/height → fill the container and track its measured size;\n // explicit pixel values override. See AreaGraph for the reference pattern.\n const [containerRef, measured] = useElementSize<HTMLDivElement>();\n const resolvedWidth = width ?? measured.width;\n const resolvedHeight = height ?? measured.height;\n const hasSize = resolvedWidth > 0 && resolvedHeight > 0;\n // Fill is per-dimension: omit width to fill the container width, omit height\n // to fill its height (so e.g. a fixed width with a container-driven height works).\n const fillWidth = width === undefined;\n const fillHeight = height === undefined;\n const sizeRef = useRef({ width: resolvedWidth, height: resolvedHeight });\n sizeRef.current = { width: resolvedWidth, height: resolvedHeight };\n const plotInitedRef = useRef(false);\n // Size last applied to the plot, so the resize effect can skip a redundant\n // relayout right after newPlot already drew at that size.\n const appliedSizeRef = useRef({ width: 0, height: 0 });\n\n const { yMin, yMax } = useMemo(() => {\n let minX = Number.MAX_VALUE;\n let maxX = Number.MIN_VALUE;\n let minY = Number.MAX_VALUE;\n let maxY = Number.MIN_VALUE;\n\n dataSeries.forEach((series) => {\n series.x.forEach((x) => {\n minX = Math.min(minX, x);\n maxX = Math.max(maxX, x);\n });\n series.y.forEach((y) => {\n minY = Math.min(minY, y);\n maxY = Math.max(maxY, y);\n });\n });\n\n const xPadding = (maxX - minX) * 0.1;\n const yPadding = (maxY - minY) * 0.1;\n\n return {\n xMin: minX - xPadding,\n xMax: maxX + xPadding,\n yMin: variant === \"stack\" ? 0 : minY - yPadding,\n yMax: maxY + yPadding,\n };\n }, [dataSeries, variant]);\n\n const effectiveYRange = useMemo(\n () => yRange || [yMin, yMax],\n [yRange, yMin, yMax],\n );\n\n const xTicks = useMemo(\n () => [...new Set(dataSeries.flatMap((s) => s.x))].sort((a, b) => a - b),\n [dataSeries],\n );\n\n // Only apply categorical labels when they align 1:1 with the tick positions;\n // a mismatch would silently mis-label ticks, so fall back to numeric ticks.\n const useCategoricalX = !!xTickText && xTickText.length === xTicks.length;\n\n const yTicks = useMemo(() => {\n const range = effectiveYRange[1] - effectiveYRange[0];\n let step = Math.pow(10, Math.floor(Math.log10(range)));\n\n if (range / step > 10) step = step * 2;\n if (range / step < 4) step = step / 2;\n\n const ticks = [];\n let current = Math.ceil(effectiveYRange[0] / step) * step;\n while (current <= effectiveYRange[1]) {\n ticks.push(current);\n current += step;\n }\n return ticks;\n }, [effectiveYRange]);\n\n const barMode = useMemo((): \"group\" | \"stack\" | \"overlay\" => {\n switch (variant) {\n case \"stack\":\n return \"stack\";\n case \"overlay\":\n return \"overlay\";\n case \"group\":\n default:\n return \"group\";\n }\n }, [variant]);\n\n const tickOptions = useMemo(\n () => ({\n tickcolor: theme.tickColor,\n ticklen: 12,\n tickwidth: 1,\n ticks: \"outside\" as const,\n tickfont: {\n size: 16,\n color: theme.textColor,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n linecolor: theme.lineColor,\n linewidth: 1,\n position: 0,\n zeroline: false,\n }),\n [theme],\n );\n\n useEffect(() => {\n if (!plotRef.current || !hasSize) return;\n\n const data = dataSeries.map((series, index) => ({\n x: series.x,\n y: series.y,\n type: \"bar\" as const,\n name: series.name,\n hoverinfo: \"none\" as const,\n marker: {\n color: seriesColor(index, series.color),\n },\n width: barWidth,\n error_y: series.error_y,\n }));\n\n const layout = {\n ...(title\n ? {\n title: {\n text: title,\n font: {\n size: 32,\n family: \"Inter, sans-serif\",\n color: theme.textColor,\n },\n },\n }\n : {}),\n width: sizeRef.current.width,\n height: sizeRef.current.height,\n margin: {\n l: 80,\n r: 30,\n // Reserve room for tick labels, the x-axis title, and the\n // container-anchored bottom legend stacked beneath them.\n b: 96,\n t: title ? TITLE_MARGIN_TOP : NO_TITLE_MARGIN_TOP,\n pad: 0,\n },\n paper_bgcolor: theme.paperBg,\n plot_bgcolor: theme.plotBg,\n font: {\n family: \"Inter, sans-serif\",\n },\n barmode: barMode,\n bargap: 0.15,\n dragmode: false as const,\n xaxis: {\n title: {\n text: xTitle,\n font: {\n size: 16,\n color: theme.textSecondary,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n standoff: 32,\n },\n gridcolor: theme.gridColor,\n range: xRange,\n autorange: !xRange,\n tickmode: \"array\" as const,\n tickvals: xTicks,\n ...(useCategoricalX ? { ticktext: xTickText } : {}),\n showgrid: true,\n // Reserve space for tick labels + the axis title so the bottom legend\n // can't overlap them at small sizes (SW-2157).\n automargin: true,\n ...tickOptions,\n },\n yaxis: {\n title: {\n text: yTitle,\n font: {\n size: 16,\n color: theme.textSecondary,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n standoff: 30,\n },\n gridcolor: theme.gridColor,\n range: yRange,\n autorange: !yRange,\n tickmode: \"array\" as const,\n tickvals: yTicks,\n showgrid: true,\n automargin: true,\n ...tickOptions,\n },\n legend: {\n // Anchor to the bottom of the container (not the plot area) so the\n // legend always clears the x-axis tick labels + title — a paper-relative\n // fractional offset collapses into the ticks at small heights (SW-2157).\n x: 0.5,\n y: 0,\n xanchor: \"center\" as const,\n yanchor: \"bottom\" as const,\n yref: \"container\" as const,\n orientation: \"h\" as const,\n font: {\n size: 16,\n color: theme.legendColor,\n family: \"Inter, sans-serif\",\n weight: 500,\n },\n },\n showlegend: dataSeries.length > 1,\n };\n\n const config = {\n // Sizing is driven from the measured container; disable Plotly's own\n // window-resize responsiveness (it can't see container resizes).\n responsive: false,\n displayModeBar: false,\n displaylogo: false,\n };\n\n Plotly.newPlot(plotRef.current, data, layout, config);\n bindTooltip(plotRef.current);\n\n // Capture ref value for cleanup\n const plotElement = plotRef.current;\n plotInitedRef.current = true;\n appliedSizeRef.current = { ...sizeRef.current };\n\n // Cleanup function\n return () => {\n if (plotElement) {\n Plotly.purge(plotElement);\n plotInitedRef.current = false;\n }\n };\n }, [dataSeries, hasSize, xRange, yRange, xTitle, yTitle, title, barWidth, barMode, tickOptions, xTicks, yTicks, useCategoricalX, xTickText, theme, bindTooltip]);\n\n // Resize in place when the measured/overridden size changes — cheaper than\n // recreating the plot, and it preserves tooltip/event bindings.\n useEffect(() => {\n const plotElement = plotRef.current;\n if (!plotElement || !plotInitedRef.current || resolvedWidth <= 0 || resolvedHeight <= 0) {\n return;\n }\n // newPlot already drew at the current size; skip the redundant relayout\n // (it would queue an automargin redraw that can reject if we unmount first).\n if (\n appliedSizeRef.current.width === resolvedWidth &&\n appliedSizeRef.current.height === resolvedHeight\n ) {\n return;\n }\n appliedSizeRef.current = { width: resolvedWidth, height: resolvedHeight };\n // Swallow rejections from a relayout that races an unmount/purge.\n void Plotly.relayout(plotElement, { width: resolvedWidth, height: resolvedHeight }).catch(\n () => {},\n );\n }, [resolvedWidth, resolvedHeight]);\n\n return (\n <div\n ref={containerRef}\n className={cn(\"bar-graph-container relative\", fillWidth && \"w-full\", fillHeight && \"h-full\")}\n >\n <div ref={plotRef} style={{ width: \"100%\", height: \"100%\" }} />\n {tooltipElement}\n </div>\n );\n};\n\nexport { BarGraph };\nexport type { BarDataSeries, BarGraphVariant, BarGraphProps };\n"],"names":["TITLE_MARGIN_TOP","NO_TITLE_MARGIN_TOP","BarGraph","dataSeries","width","height","xRange","yRange","variant","xTitle","yTitle","title","barWidth","xTickText","plotRef","useRef","theme","usePlotlyTheme","bindTooltip","tooltipElement","useChartTooltip","containerRef","measured","useElementSize","resolvedWidth","resolvedHeight","hasSize","fillWidth","fillHeight","sizeRef","plotInitedRef","appliedSizeRef","yMin","yMax","useMemo","minX","maxX","minY","maxY","series","x","y","xPadding","yPadding","effectiveYRange","xTicks","s","a","b","useCategoricalX","yTicks","range","step","ticks","current","barMode","tickOptions","useEffect","data","index","seriesColor","layout","config","Plotly","plotElement","jsxs","cn","jsx"],"mappings":";;;;;;;;AA0BA,MAAMA,IAAmB,IACnBC,IAAsB,IA8BtBC,KAAoC,CAAC;AAAA,EACzC,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,SAAAC,IAAU;AAAA,EACV,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC;AAAA,EACA,UAAAC,IAAW;AAAA,EACX,WAAAC;AACF,MAAM;AACJ,QAAMC,IAAUC,EAAuB,IAAI,GACrCC,IAAQC,EAAA,GACR,EAAE,aAAAC,GAAa,gBAAAC,EAAA,IAAmBC,EAAgB,EAAE,QAAQX,GAAQ,QAAQC,GAAQ,GAIpF,CAACW,GAAcC,CAAQ,IAAIC,EAAA,GAC3BC,IAAgBpB,KAASkB,EAAS,OAClCG,IAAiBpB,KAAUiB,EAAS,QACpCI,IAAUF,IAAgB,KAAKC,IAAiB,GAGhDE,IAAYvB,M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MAAM;AACd,UAAMO,IAAclD,EAAQ;AAC5B,IAAI,CAACkD,KAAe,CAAClC,EAAc,WAAWN,KAAiB,KAAKC,KAAkB,KAMpFM,EAAe,QAAQ,UAAUP,KACjCO,EAAe,QAAQ,WAAWN,MAIpCM,EAAe,UAAU,EAAE,OAAOP,GAAe,QAAQC,EAAA,GAEpDsC,EAAO,SAASC,GAAa,EAAE,OAAOxC,GAAe,QAAQC,EAAA,CAAgB,EAAE;AAAA,MAClF,MAAM;AAAA,MAAC;AAAA,IAAA;AAAA,EAEX,GAAG,CAACD,GAAeC,CAAc,CAAC,GAGhC,gBAAAwC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAK5C;AAAA,MACL,WAAW6C,EAAG,gCAAgCvC,KAAa,UAAUC,KAAc,QAAQ;AAAA,MAE3F,UAAA;AAAA,QAAA,gBAAAuC,EAAC,OAAA,EAAI,KAAKrD,GAAS,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAA,EAAO,CAAG;AAAA,QAC5DK;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const O=require("react/jsx-runtime"),b=require("plotly.js-dist"),r=require("react"),A=require("../ChartTooltip/ChartTooltip.cjs"),U=require("../../../hooks/use-element-size.cjs"),W=require("../../../hooks/use-plotly-theme.cjs"),Y=require("../../../lib/utils.cjs"),H=require("../../../utils/colors.cjs"),V=-1.8,D=({dataSeries:d,width:v,height:k,xRange:m,yRange:f,xTitle:y,yTitle:x,title:E="Boxplot",showPoints:z=!1})=>{const u=r.useRef(null),e=W.usePlotlyTheme(),{bindTooltip:I,tooltipElement:R}=A.useChartTooltip({xLabel:y,yLabel:x}),[S,C]=U.useElementSize(),i=v??C.width,l=k??C.height,q=i>0&&l>0,T=v===void 0,_=k===void 0,g=r.useRef({width:i,height:l});g.current={width:i,height:l};const w=r.useRef(!1),p=r.useRef({width:0,height:0}),{yMin:P,yMax:j}=r.useMemo(()=>{let o=Number.MAX_VALUE,t=Number.MIN_VALUE;d.forEach(s=>{s.y.forEach(n=>{o=Math.min(o,n),t=Math.max(t,n)})});const c=(t-o)*.1;return{yMin:o-c,yMax:t+c}},[d]),h=r.useMemo(()=>f||[P,j],[f,P,j]),B=r.useMemo(()=>{const o=h[1]-h[0];let t=Math.pow(10,Math.floor(Math.log10(o)));o/t>10&&(t=t*2),o/t<4&&(t=t/2);const c=[];let s=Math.ceil(h[0]/t)*t;for(;s<=h[1];)c.push(s),s+=t;return c},[h]),M=r.useMemo(()=>({tickcolor:e.tickColor,ticklen:12,tickwidth:1,ticks:"outside",tickfont:{size:16,color:e.textColor,family:"Inter, sans-serif",weight:400},linecolor:e.lineColor,linewidth:1,position:0,zeroline:!1}),[e]),N=r.useMemo(()=>({text:E,x:.5,y:.95,xanchor:"center",yanchor:"top",font:{size:32,weight:600,family:"Inter, sans-serif",color:e.textColor,lineheight:1.2,standoff:30}}),[E,e]);return r.useEffect(()=>{if(!u.current||!q)return;const o=d.map((n,L)=>{const a=H.seriesColor(L,n.color);return{y:n.y,x:n.x,type:"box",name:n.name,hoverinfo:"none",marker:{color:a},line:{color:a},fillcolor:typeof a=="string"&&a.startsWith("#")&&a.length===7?`${a}40`:a,boxpoints:z?n.boxpoints||"outliers":!1,jitter:n.jitter||.3,pointpos:n.pointpos||V}}),t={width:g.current.width,height:g.current.height,title:N,margin:{l:80,r:40,b:96,t:80,pad:0},paper_bgcolor:e.paperBg,plot_bgcolor:e.plotBg,font:{family:"Inter, sans-serif"},dragmode:!1,xaxis:{title:{text:y,font:{size:16,color:e.textSecondary,family:"Inter, sans-serif",weight:400},standoff:15},gridcolor:e.gridColor,range:m,autorange:!m,showgrid:!0,automargin:!0,...M},yaxis:{title:{text:x,font:{size:16,color:e.textSecondary,family:"Inter, sans-serif",weight:400},standoff:15},gridcolor:e.gridColor,range:f,autorange:!f,tickmode:"array",tickvals:B,showgrid:!0,automargin:!0,...M},legend:{x:.5,y:0,xanchor:"center",yanchor:"bottom",yref:"container",orientation:"h",font:{size:13,color:e.legendColor,family:"Inter, sans-serif",weight:500,lineheight:18}},showlegend:!0},c={responsive:!1,displayModeBar:!1,displaylogo:!1};b.newPlot(u.current,o,t,c),I(u.current);const s=u.current;return w.current=!0,p.current={...g.current},()=>{s&&(b.purge(s),w.current=!1)}},[d,q,m,f,h,y,x,z,N,M,B,e,I]),r.useEffect(()=>{const o=u.current;!o||!w.current||i<=0||l<=0||p.current.width===i&&p.current.height===l||(p.current={width:i,height:l},b.relayout(o,{width:i,height:l}).catch(()=>{}))},[i,l]),O.jsxs("div",{ref:S,className:Y.cn("boxplot-container relative",T&&"w-full",_&&"h-full"),children:[O.jsx("div",{ref:u,style:{width:"100%",height:"100%"}}),R]})};exports.Boxplot=D;
2
- //# sourceMappingURL=Boxplot.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"Boxplot.cjs","sources":["../../../../src/components/charts/Boxplot/Boxplot.tsx"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\nimport React, { useEffect, useRef, useMemo } from \"react\";\n\nimport { useChartTooltip } from \"../ChartTooltip\";\n\nimport { useElementSize } from \"@/hooks/use-element-size\";\nimport { usePlotlyTheme } from \"@/hooks/use-plotly-theme\";\nimport { cn } from \"@/lib/utils\";\nimport { seriesColor } from \"@/utils/colors\";\n\n/** Default point position offset from the box edge */\nconst DEFAULT_POINT_POSITION = -1.8;\n\ninterface BoxDataSeries {\n y: number[];\n name: string;\n /** Optional color override (auto-assigned from CHART_COLORS if not provided) */\n color?: string;\n x?: string[] | number[];\n boxpoints?: \"all\" | \"outliers\" | \"suspectedoutliers\" | false;\n jitter?: number;\n pointpos?: number;\n}\n\ninterface BoxplotProps {\n dataSeries: BoxDataSeries[];\n /**\n * Fixed width in pixels. When omitted, the chart fills its container and\n * tracks the container's width via a `ResizeObserver`.\n */\n width?: number;\n /**\n * Fixed height in pixels. When omitted, the chart fills its container and\n * tracks the container's height via a `ResizeObserver`.\n */\n height?: number;\n xRange?: [number, number];\n yRange?: [number, number];\n xTitle?: string;\n yTitle?: string;\n title?: string;\n showPoints?: boolean;\n}\n\nconst Boxplot: React.FC<BoxplotProps> = ({\n dataSeries,\n width,\n height,\n xRange,\n yRange,\n xTitle,\n yTitle,\n title = \"Boxplot\",\n showPoints = false,\n}) => {\n const plotRef = useRef<HTMLDivElement>(null);\n const theme = usePlotlyTheme();\n const { bindTooltip, tooltipElement } = useChartTooltip({ xLabel: xTitle, yLabel: yTitle });\n\n // Omitted width/height → fill the container and track its measured size;\n // explicit pixel values override. See AreaGraph for the reference pattern.\n const [containerRef, measured] = useElementSize<HTMLDivElement>();\n const resolvedWidth = width ?? measured.width;\n const resolvedHeight = height ?? measured.height;\n const hasSize = resolvedWidth > 0 && resolvedHeight > 0;\n // Fill is per-dimension: omit width to fill the container width, omit height\n // to fill its height (so e.g. a fixed width with a container-driven height works).\n const fillWidth = width === undefined;\n const fillHeight = height === undefined;\n const sizeRef = useRef({ width: resolvedWidth, height: resolvedHeight });\n sizeRef.current = { width: resolvedWidth, height: resolvedHeight };\n const plotInitedRef = useRef(false);\n // Size last applied to the plot, so the resize effect can skip a redundant\n // relayout right after newPlot already drew at that size.\n const appliedSizeRef = useRef({ width: 0, height: 0 });\n\n const { yMin, yMax } = useMemo(() => {\n let minY = Number.MAX_VALUE;\n let maxY = Number.MIN_VALUE;\n\n dataSeries.forEach((series) => {\n series.y.forEach((y) => {\n minY = Math.min(minY, y);\n maxY = Math.max(maxY, y);\n });\n });\n\n const yPadding = (maxY - minY) * 0.1;\n\n return {\n yMin: minY - yPadding,\n yMax: maxY + yPadding,\n };\n }, [dataSeries]);\n\n const effectiveYRange = useMemo(\n () => yRange || [yMin, yMax],\n [yRange, yMin, yMax],\n );\n\n const yTicks = useMemo(() => {\n const range = effectiveYRange[1] - effectiveYRange[0];\n let step = Math.pow(10, Math.floor(Math.log10(range)));\n\n if (range / step > 10) step = step * 2;\n if (range / step < 4) step = step / 2;\n\n const ticks = [];\n let current = Math.ceil(effectiveYRange[0] / step) * step;\n while (current <= effectiveYRange[1]) {\n ticks.push(current);\n current += step;\n }\n return ticks;\n }, [effectiveYRange]);\n\n const tickOptions = useMemo(\n () => ({\n tickcolor: theme.tickColor,\n ticklen: 12,\n tickwidth: 1,\n ticks: \"outside\" as const,\n tickfont: {\n size: 16,\n color: theme.textColor,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n linecolor: theme.lineColor,\n linewidth: 1,\n position: 0,\n zeroline: false,\n }),\n [theme],\n );\n\n const titleOptions = useMemo(\n () => ({\n text: title,\n x: 0.5,\n y: 0.95,\n xanchor: \"center\" as const,\n yanchor: \"top\" as const,\n font: {\n size: 32,\n weight: 600,\n family: \"Inter, sans-serif\",\n color: theme.textColor,\n lineheight: 1.2,\n standoff: 30,\n },\n }),\n [title, theme],\n );\n\n useEffect(() => {\n if (!plotRef.current || !hasSize) return;\n\n const data = dataSeries.map((series, index) => {\n const color = seriesColor(index, series.color);\n return {\n y: series.y,\n x: series.x,\n type: \"box\" as const,\n name: series.name,\n hoverinfo: \"none\" as const,\n marker: {\n color,\n },\n line: {\n color,\n },\n fillcolor:\n typeof color === \"string\" && color.startsWith(\"#\") && color.length === 7\n ? `${color}40`\n : color, // Add transparency for hex colors only\n boxpoints: showPoints\n ? series.boxpoints || \"outliers\"\n : (false as const),\n jitter: series.jitter || 0.3,\n pointpos: series.pointpos || DEFAULT_POINT_POSITION,\n };\n });\n\n const layout = {\n width: sizeRef.current.width,\n height: sizeRef.current.height,\n title: titleOptions,\n // Bottom margin reserves room for tick labels, the x-axis title, and the\n // container-anchored bottom legend stacked beneath them.\n margin: { l: 80, r: 40, b: 96, t: 80, pad: 0 },\n paper_bgcolor: theme.paperBg,\n plot_bgcolor: theme.plotBg,\n font: {\n family: \"Inter, sans-serif\",\n },\n dragmode: false as const,\n xaxis: {\n title: {\n text: xTitle,\n font: {\n size: 16,\n color: theme.textSecondary,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n standoff: 15,\n },\n gridcolor: theme.gridColor,\n range: xRange,\n autorange: !xRange,\n showgrid: true,\n // Reserve space for tick labels + the axis title so the bottom legend\n // can't overlap them at small sizes (SW-2157).\n automargin: true,\n ...tickOptions,\n },\n yaxis: {\n title: {\n text: yTitle,\n font: {\n size: 16,\n color: theme.textSecondary,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n standoff: 15,\n },\n gridcolor: theme.gridColor,\n range: yRange,\n autorange: !yRange,\n tickmode: \"array\" as const,\n tickvals: yTicks,\n showgrid: true,\n automargin: true,\n ...tickOptions,\n },\n legend: {\n // Anchor to the bottom of the container (not the plot area) so the\n // legend always clears the x-axis tick labels + title — a paper-relative\n // fractional offset collapses into the ticks at small heights (SW-2157).\n x: 0.5,\n y: 0,\n xanchor: \"center\" as const,\n yanchor: \"bottom\" as const,\n yref: \"container\" as const,\n orientation: \"h\" as const,\n font: {\n size: 13,\n color: theme.legendColor,\n family: \"Inter, sans-serif\",\n weight: 500,\n lineheight: 18,\n },\n },\n showlegend: true,\n };\n\n const config = {\n // Sizing is driven from the measured container; disable Plotly's own\n // window-resize responsiveness (it can't see container resizes).\n responsive: false,\n displayModeBar: false,\n displaylogo: false,\n };\n\n Plotly.newPlot(plotRef.current, data, layout, config);\n bindTooltip(plotRef.current);\n\n // Capture ref value for cleanup\n const plotElement = plotRef.current;\n plotInitedRef.current = true;\n appliedSizeRef.current = { ...sizeRef.current };\n\n // Cleanup function\n return () => {\n if (plotElement) {\n Plotly.purge(plotElement);\n plotInitedRef.current = false;\n }\n };\n }, [dataSeries, hasSize, xRange, yRange, effectiveYRange, xTitle, yTitle, showPoints, titleOptions, tickOptions, yTicks, theme, bindTooltip]);\n\n // Resize in place when the measured/overridden size changes — cheaper than\n // recreating the plot, and it preserves tooltip/event bindings.\n useEffect(() => {\n const plotElement = plotRef.current;\n if (!plotElement || !plotInitedRef.current || resolvedWidth <= 0 || resolvedHeight <= 0) {\n return;\n }\n // newPlot already drew at the current size; skip the redundant relayout\n // (it would queue an automargin redraw that can reject if we unmount first).\n if (\n appliedSizeRef.current.width === resolvedWidth &&\n appliedSizeRef.current.height === resolvedHeight\n ) {\n return;\n }\n appliedSizeRef.current = { width: resolvedWidth, height: resolvedHeight };\n // Swallow rejections from a relayout that races an unmount/purge.\n void Plotly.relayout(plotElement, { width: resolvedWidth, height: resolvedHeight }).catch(\n () => {},\n );\n }, [resolvedWidth, resolvedHeight]);\n\n return (\n <div\n ref={containerRef}\n className={cn(\"boxplot-container relative\", fillWidth && \"w-full\", fillHeight && \"h-full\")}\n >\n <div ref={plotRef} style={{ width: \"100%\", height: \"100%\" }} />\n {tooltipElement}\n </div>\n );\n};\n\nexport { Boxplot };\nexport type { BoxDataSeries, BoxplotProps };\n"],"names":["DEFAULT_POINT_POSITION","Boxplot","dataSeries","width","height","xRange","yRange","xTitle","yTitle","title","showPoints","plotRef","useRef","theme","usePlotlyTheme","bindTooltip","tooltipElement","useChartTooltip","containerRef","measured","useElementSize","resolvedWidth","resolvedHeight","hasSize","fillWidth","fillHeight","sizeRef","plotInitedRef","appliedSizeRef","yMin","yMax","useMemo","minY","maxY","series","y","yPadding","effectiveYRange","yTicks","range","step","ticks","current","tickOptions","titleOptions","useEffect","data","index","color","seriesColor","layout","config","Plotly","plotElement","jsxs","cn","jsx"],"mappings":"+XAWMA,EAAyB,KAiCzBC,EAAkC,CAAC,CACvC,WAAAC,EACA,MAAAC,EACA,OAAAC,EACA,OAAAC,EACA,OAAAC,EACA,OAAAC,EACA,OAAAC,EACA,MAAAC,EAAQ,UACR,WAAAC,EAAa,EACf,IAAM,CACJ,MAAMC,EAAUC,EAAAA,OAAuB,IAAI,EACrCC,EAAQC,EAAAA,eAAA,EACR,CAAE,YAAAC,EAAa,eAAAC,CAAA,EAAmBC,EAAAA,gBAAgB,CAAE,OAAQV,EAAQ,OAAQC,EAAQ,EAIpF,CAACU,EAAcC,CAAQ,EAAIC,iBAAA,EAC3BC,EAAgBlB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,CACd,MAAMQ,EAAc1C,EAAQ,QACxB,CAAC0C,GAAe,CAAC1B,EAAc,SAAWN,GAAiB,GAAKC,GAAkB,GAMpFM,EAAe,QAAQ,QAAUP,GACjCO,EAAe,QAAQ,SAAWN,IAIpCM,EAAe,QAAU,CAAE,MAAOP,EAAe,OAAQC,CAAA,EAEpD8B,EAAO,SAASC,EAAa,CAAE,MAAOhC,EAAe,OAAQC,CAAA,CAAgB,EAAE,MAClF,IAAM,CAAC,CAAA,EAEX,EAAG,CAACD,EAAeC,CAAc,CAAC,EAGhCgC,EAAAA,KAAC,MAAA,CACC,IAAKpC,EACL,UAAWqC,EAAAA,GAAG,6BAA8B/B,GAAa,SAAUC,GAAc,QAAQ,EAEzF,SAAA,CAAA+B,EAAAA,IAAC,MAAA,CAAI,IAAK7C,EAAS,MAAO,CAAE,MAAO,OAAQ,OAAQ,MAAA,CAAO,CAAG,EAC5DK,CAAA,CAAA,CAAA,CAGP"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"Boxplot.js","sources":["../../../../src/components/charts/Boxplot/Boxplot.tsx"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\nimport React, { useEffect, useRef, useMemo } from \"react\";\n\nimport { useChartTooltip } from \"../ChartTooltip\";\n\nimport { useElementSize } from \"@/hooks/use-element-size\";\nimport { usePlotlyTheme } from \"@/hooks/use-plotly-theme\";\nimport { cn } from \"@/lib/utils\";\nimport { seriesColor } from \"@/utils/colors\";\n\n/** Default point position offset from the box edge */\nconst DEFAULT_POINT_POSITION = -1.8;\n\ninterface BoxDataSeries {\n y: number[];\n name: string;\n /** Optional color override (auto-assigned from CHART_COLORS if not provided) */\n color?: string;\n x?: string[] | number[];\n boxpoints?: \"all\" | \"outliers\" | \"suspectedoutliers\" | false;\n jitter?: number;\n pointpos?: number;\n}\n\ninterface BoxplotProps {\n dataSeries: BoxDataSeries[];\n /**\n * Fixed width in pixels. When omitted, the chart fills its container and\n * tracks the container's width via a `ResizeObserver`.\n */\n width?: number;\n /**\n * Fixed height in pixels. When omitted, the chart fills its container and\n * tracks the container's height via a `ResizeObserver`.\n */\n height?: number;\n xRange?: [number, number];\n yRange?: [number, number];\n xTitle?: string;\n yTitle?: string;\n title?: string;\n showPoints?: boolean;\n}\n\nconst Boxplot: React.FC<BoxplotProps> = ({\n dataSeries,\n width,\n height,\n xRange,\n yRange,\n xTitle,\n yTitle,\n title = \"Boxplot\",\n showPoints = false,\n}) => {\n const plotRef = useRef<HTMLDivElement>(null);\n const theme = usePlotlyTheme();\n const { bindTooltip, tooltipElement } = useChartTooltip({ xLabel: xTitle, yLabel: yTitle });\n\n // Omitted width/height → fill the container and track its measured size;\n // explicit pixel values override. See AreaGraph for the reference pattern.\n const [containerRef, measured] = useElementSize<HTMLDivElement>();\n const resolvedWidth = width ?? measured.width;\n const resolvedHeight = height ?? measured.height;\n const hasSize = resolvedWidth > 0 && resolvedHeight > 0;\n // Fill is per-dimension: omit width to fill the container width, omit height\n // to fill its height (so e.g. a fixed width with a container-driven height works).\n const fillWidth = width === undefined;\n const fillHeight = height === undefined;\n const sizeRef = useRef({ width: resolvedWidth, height: resolvedHeight });\n sizeRef.current = { width: resolvedWidth, height: resolvedHeight };\n const plotInitedRef = useRef(false);\n // Size last applied to the plot, so the resize effect can skip a redundant\n // relayout right after newPlot already drew at that size.\n const appliedSizeRef = useRef({ width: 0, height: 0 });\n\n const { yMin, yMax } = useMemo(() => {\n let minY = Number.MAX_VALUE;\n let maxY = Number.MIN_VALUE;\n\n dataSeries.forEach((series) => {\n series.y.forEach((y) => {\n minY = Math.min(minY, y);\n maxY = Math.max(maxY, y);\n });\n });\n\n const yPadding = (maxY - minY) * 0.1;\n\n return {\n yMin: minY - yPadding,\n yMax: maxY + yPadding,\n };\n }, [dataSeries]);\n\n const effectiveYRange = useMemo(\n () => yRange || [yMin, yMax],\n [yRange, yMin, yMax],\n );\n\n const yTicks = useMemo(() => {\n const range = effectiveYRange[1] - effectiveYRange[0];\n let step = Math.pow(10, Math.floor(Math.log10(range)));\n\n if (range / step > 10) step = step * 2;\n if (range / step < 4) step = step / 2;\n\n const ticks = [];\n let current = Math.ceil(effectiveYRange[0] / step) * step;\n while (current <= effectiveYRange[1]) {\n ticks.push(current);\n current += step;\n }\n return ticks;\n }, [effectiveYRange]);\n\n const tickOptions = useMemo(\n () => ({\n tickcolor: theme.tickColor,\n ticklen: 12,\n tickwidth: 1,\n ticks: \"outside\" as const,\n tickfont: {\n size: 16,\n color: theme.textColor,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n linecolor: theme.lineColor,\n linewidth: 1,\n position: 0,\n zeroline: false,\n }),\n [theme],\n );\n\n const titleOptions = useMemo(\n () => ({\n text: title,\n x: 0.5,\n y: 0.95,\n xanchor: \"center\" as const,\n yanchor: \"top\" as const,\n font: {\n size: 32,\n weight: 600,\n family: \"Inter, sans-serif\",\n color: theme.textColor,\n lineheight: 1.2,\n standoff: 30,\n },\n }),\n [title, theme],\n );\n\n useEffect(() => {\n if (!plotRef.current || !hasSize) return;\n\n const data = dataSeries.map((series, index) => {\n const color = seriesColor(index, series.color);\n return {\n y: series.y,\n x: series.x,\n type: \"box\" as const,\n name: series.name,\n hoverinfo: \"none\" as const,\n marker: {\n color,\n },\n line: {\n color,\n },\n fillcolor:\n typeof color === \"string\" && color.startsWith(\"#\") && color.length === 7\n ? `${color}40`\n : color, // Add transparency for hex colors only\n boxpoints: showPoints\n ? series.boxpoints || \"outliers\"\n : (false as const),\n jitter: series.jitter || 0.3,\n pointpos: series.pointpos || DEFAULT_POINT_POSITION,\n };\n });\n\n const layout = {\n width: sizeRef.current.width,\n height: sizeRef.current.height,\n title: titleOptions,\n // Bottom margin reserves room for tick labels, the x-axis title, and the\n // container-anchored bottom legend stacked beneath them.\n margin: { l: 80, r: 40, b: 96, t: 80, pad: 0 },\n paper_bgcolor: theme.paperBg,\n plot_bgcolor: theme.plotBg,\n font: {\n family: \"Inter, sans-serif\",\n },\n dragmode: false as const,\n xaxis: {\n title: {\n text: xTitle,\n font: {\n size: 16,\n color: theme.textSecondary,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n standoff: 15,\n },\n gridcolor: theme.gridColor,\n range: xRange,\n autorange: !xRange,\n showgrid: true,\n // Reserve space for tick labels + the axis title so the bottom legend\n // can't overlap them at small sizes (SW-2157).\n automargin: true,\n ...tickOptions,\n },\n yaxis: {\n title: {\n text: yTitle,\n font: {\n size: 16,\n color: theme.textSecondary,\n family: \"Inter, sans-serif\",\n weight: 400,\n },\n standoff: 15,\n },\n gridcolor: theme.gridColor,\n range: yRange,\n autorange: !yRange,\n tickmode: \"array\" as const,\n tickvals: yTicks,\n showgrid: true,\n automargin: true,\n ...tickOptions,\n },\n legend: {\n // Anchor to the bottom of the container (not the plot area) so the\n // legend always clears the x-axis tick labels + title — a paper-relative\n // fractional offset collapses into the ticks at small heights (SW-2157).\n x: 0.5,\n y: 0,\n xanchor: \"center\" as const,\n yanchor: \"bottom\" as const,\n yref: \"container\" as const,\n orientation: \"h\" as const,\n font: {\n size: 13,\n color: theme.legendColor,\n family: \"Inter, sans-serif\",\n weight: 500,\n lineheight: 18,\n },\n },\n showlegend: true,\n };\n\n const config = {\n // Sizing is driven from the measured container; disable Plotly's own\n // window-resize responsiveness (it can't see container resizes).\n responsive: false,\n displayModeBar: false,\n displaylogo: false,\n };\n\n Plotly.newPlot(plotRef.current, data, layout, config);\n bindTooltip(plotRef.current);\n\n // Capture ref value for cleanup\n const plotElement = plotRef.current;\n plotInitedRef.current = true;\n appliedSizeRef.current = { ...sizeRef.current };\n\n // Cleanup function\n return () => {\n if (plotElement) {\n Plotly.purge(plotElement);\n plotInitedRef.current = false;\n }\n };\n }, [dataSeries, hasSize, xRange, yRange, effectiveYRange, xTitle, yTitle, showPoints, titleOptions, tickOptions, yTicks, theme, bindTooltip]);\n\n // Resize in place when the measured/overridden size changes — cheaper than\n // recreating the plot, and it preserves tooltip/event bindings.\n useEffect(() => {\n const plotElement = plotRef.current;\n if (!plotElement || !plotInitedRef.current || resolvedWidth <= 0 || resolvedHeight <= 0) {\n return;\n }\n // newPlot already drew at the current size; skip the redundant relayout\n // (it would queue an automargin redraw that can reject if we unmount first).\n if (\n appliedSizeRef.current.width === resolvedWidth &&\n appliedSizeRef.current.height === resolvedHeight\n ) {\n return;\n }\n appliedSizeRef.current = { width: resolvedWidth, height: resolvedHeight };\n // Swallow rejections from a relayout that races an unmount/purge.\n void Plotly.relayout(plotElement, { width: resolvedWidth, height: resolvedHeight }).catch(\n () => {},\n );\n }, [resolvedWidth, resolvedHeight]);\n\n return (\n <div\n ref={containerRef}\n className={cn(\"boxplot-container relative\", fillWidth && \"w-full\", fillHeight && \"h-full\")}\n >\n <div ref={plotRef} style={{ width: \"100%\", height: \"100%\" }} />\n {tooltipElement}\n </div>\n );\n};\n\nexport { Boxplot };\nexport type { BoxDataSeries, BoxplotProps };\n"],"names":["DEFAULT_POINT_POSITION","Boxplot","dataSeries","width","height","xRange","yRange","xTitle","yTitle","title","showPoints","plotRef","useRef","theme","usePlotlyTheme","bindTooltip","tooltipElement","useChartTooltip","containerRef","measured","useElementSize","resolvedWidth","resolvedHeight","hasSize","fillWidth","fillHeight","sizeRef","plotInitedRef","appliedSizeRef","yMin","yMax","useMemo","minY","maxY","series","y","yPadding","effectiveYRange","yTicks","range","step","ticks","current","tickOptions","titleOptions","useEffect","data","index","color","seriesColor","layout","config","Plotly","plotElement","jsxs","cn","jsx"],"mappings":";;;;;;;;AAWA,MAAMA,IAAyB,MAiCzBC,KAAkC,CAAC;AAAA,EACvC,YAAAC;AAAA,EACA,OAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,QAAAC;AAAA,EACA,OAAAC,IAAQ;AAAA,EACR,YAAAC,IAAa;AACf,MAAM;AACJ,QAAMC,IAAUC,EAAuB,IAAI,GACrCC,IAAQC,EAAA,GACR,EAAE,aAAAC,GAAa,gBAAAC,EAAA,IAAmBC,EAAgB,E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AA,MAAC;AAAA,IAAA;AAAA,EAEX,GAAG,CAACD,GAAeC,CAAc,CAAC,GAGhC,gBAAAgC;AAAA,IAAC;AAAA,IAAA;AAAA,MACC,KAAKpC;AAAA,MACL,WAAWqC,EAAG,8BAA8B/B,KAAa,UAAUC,KAAc,QAAQ;AAAA,MAEzF,UAAA;AAAA,QAAA,gBAAA+B,EAAC,OAAA,EAAI,KAAK7C,GAAS,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAA,EAAO,CAAG;AAAA,QAC5DK;AAAA,MAAA;AAAA,IAAA;AAAA,EAAA;AAGP;"}
@@ -1,2 +0,0 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const Y=require("react/jsx-runtime"),j=require("plotly.js-dist"),u=require("react"),K=require("../../../utils/colors.cjs"),Q=require("../ChartTooltip/ChartTooltip.cjs"),D=require("./annotations.cjs"),V=require("./boundaryMarkers.cjs"),s=require("./constants.cjs"),T=require("./dataProcessing.cjs"),Z=require("./peakDetection.cjs"),X=require("../../../hooks/use-plotly-theme.cjs"),w=[],$=({series:a,width:h=900,height:A=500,title:f,xAxisTitle:M="Retention Time (min)",yAxisTitle:k="Signal (mAU)",annotations:d=w,xRange:O,yRange:I,showLegend:P=!0,showGridX:v=!0,showGridY:G=!0,showMarkers:R=!1,markerSize:q=4,showCrosshairs:p=!1,baselineCorrection:N="none",baselineWindowSize:L=50,peakDetectionOptions:l,showPeakAreas:b=!1,boundaryMarkers:z="none",annotationOverlapThreshold:B=.4,showExportButton:C=!0})=>{const m=l!==void 0,E=u.useRef(null),e=X.usePlotlyTheme(),{bindTooltip:H,tooltipElement:W}=Q.useChartTooltip({xLabel:M,yLabel:k}),n=u.useMemo(()=>a.map(o=>{const r=T.validateSeriesData(o.x,o.y);return{...o,x:r.x,y:T.applyBaselineCorrection(r.y,N,L)}}),[a,N,L]),x=u.useMemo(()=>{if(d.length===0||n.length===0)return d;const{x:o,y:r}=n[0];return T.processUserAnnotations(d,o,r)},[d,n]),_=u.useMemo(()=>{const o=[];return m&&l&&n.forEach((r,c)=>{const g=Z.detectPeaks(r.x,r.y,l);g.length>0&&o.push({peaks:g,seriesIndex:c})}),o},[n,m,l]);return u.useEffect(()=>{const o=E.current;if(!o||a.length===0)return;const r=n.map((t,i)=>{const y=K.seriesColor(i,t.color),S={x:t.x,y:t.y,type:"scatter",mode:R?"lines+markers":"lines",name:t.name,line:{color:y,width:1.5},hoverinfo:"none"};return R&&(S.marker={size:q,color:y}),S});if(z!=="none"){const t=T.collectPeaksWithBoundaryData(_,x,n);if(t.length>0){const i=V.createBoundaryMarkerTraces(t);r.push(...i)}}const c=[];x.forEach(t=>{c.push({peak:t,seriesIndex:-1})}),b&&m&&_.forEach(({peaks:t,seriesIndex:i})=>{t.forEach(y=>{c.push({peak:y,seriesIndex:i})})});const g=D.groupOverlappingPeaks(c,B),U=[];for(const t of g)U.push(...D.createGroupAnnotations(t));const F={title:f?{text:f,font:{size:20,family:"Inter, sans-serif",color:e.textColor}}:void 0,width:h,height:A,margin:{l:s.CHROMATOGRAM_LAYOUT.MARGIN_LEFT,r:s.CHROMATOGRAM_LAYOUT.MARGIN_RIGHT,b:s.CHROMATOGRAM_LAYOUT.MARGIN_BOTTOM,t:f?s.CHROMATOGRAM_LAYOUT.MARGIN_TOP_WITH_TITLE:s.CHROMATOGRAM_LAYOUT.MARGIN_TOP_NO_TITLE,pad:s.CHROMATOGRAM_LAYOUT.MARGIN_PAD},paper_bgcolor:e.paperBg,plot_bgcolor:e.plotBg,font:{family:"Inter, sans-serif"},hovermode:p?"x":"x unified",dragmode:"zoom",xaxis:{title:{text:M,font:{size:14,color:e.textSecondary,family:"Inter, sans-serif"},standoff:15},showgrid:v,gridcolor:e.gridColor,linecolor:e.lineColor,linewidth:1,range:O,autorange:!O,zeroline:!1,tickfont:{size:12,color:e.textColor,family:"Inter, sans-serif"},showspikes:p,spikemode:"across",spikesnap:"cursor",spikecolor:e.spikeColor,spikethickness:1,spikedash:"dot"},yaxis:{title:{text:k,font:{size:14,color:e.textSecondary,family:"Inter, sans-serif"},standoff:10},showgrid:G,gridcolor:e.gridColor,linecolor:e.lineColor,linewidth:1,range:I,autorange:!I,zeroline:!1,tickfont:{size:12,color:e.textColor,family:"Inter, sans-serif"},showspikes:p,spikemode:"across",spikesnap:"cursor",spikecolor:e.spikeColor,spikethickness:1,spikedash:"dot"},legend:{x:.5,y:-.15,xanchor:"center",yanchor:"top",orientation:"h",font:{size:12,color:e.textColor,family:"Inter, sans-serif"}},showlegend:P&&a.length>1,annotations:U},J={responsive:!0,displayModeBar:!0,displaylogo:!1,modeBarButtonsToRemove:["lasso2d","select2d",...C?[]:["toImage"]],...C&&{toImageButtonOptions:{format:"png",filename:"chromatogram",width:h,height:A}}};return j.newPlot(o,r,F,J),H(o),()=>{o&&j.purge(o)}},[n,_,a.length,h,A,f,M,k,x,O,I,P,v,G,R,q,p,m,l,b,z,B,C,e,H]),Y.jsxs("div",{className:"chromatogram-chart-container relative",children:[Y.jsx("div",{ref:E,style:{width:"100%",height:"100%"}}),W]})};exports.ChromatogramChart=$;
2
- //# sourceMappingURL=ChromatogramChart.cjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"ChromatogramChart.cjs","sources":["../../../../src/components/charts/ChromatogramChart/ChromatogramChart.tsx"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\nimport React, { useEffect, useMemo, useRef } from \"react\";\n\nimport { seriesColor } from \"../../../utils/colors\";\nimport { useChartTooltip } from \"../ChartTooltip\";\n\nimport {\n groupOverlappingPeaks,\n createGroupAnnotations,\n} from \"./annotations\";\nimport { createBoundaryMarkerTraces } from \"./boundaryMarkers\";\nimport { CHROMATOGRAM_LAYOUT } from \"./constants\";\nimport {\n validateSeriesData,\n applyBaselineCorrection,\n collectPeaksWithBoundaryData,\n processUserAnnotations,\n} from \"./dataProcessing\";\nimport { detectPeaks } from \"./peakDetection\";\n\nimport type {\n ChromatogramSeries,\n PeakAnnotation,\n BaselineCorrectionMethod,\n BoundaryMarkerStyle,\n BoundaryMarkerType,\n PeakDetectionOptions,\n ChromatogramChartProps,\n PeakWithMeta,\n} from \"./types\";\n\nimport { usePlotlyTheme } from \"@/hooks/use-plotly-theme\";\n\n// Re-export types for external use\nexport type {\n ChromatogramSeries,\n PeakAnnotation,\n BaselineCorrectionMethod,\n BoundaryMarkerStyle,\n BoundaryMarkerType,\n PeakDetectionOptions,\n ChromatogramChartProps,\n};\n\n\n// Stable default so the no-annotations case keeps a constant identity; an\n// inline `[]` default would change every render, re-running the plot effect\n// (and tearing down the hover tooltip) on each re-render.\nconst EMPTY_ANNOTATIONS: PeakAnnotation[] = [];\n\nconst ChromatogramChart: React.FC<ChromatogramChartProps> = ({\n series,\n width = 900,\n height = 500,\n title,\n xAxisTitle = \"Retention Time (min)\",\n yAxisTitle = \"Signal (mAU)\",\n annotations = EMPTY_ANNOTATIONS,\n xRange,\n yRange,\n showLegend = true,\n showGridX = true,\n showGridY = true,\n showMarkers = false,\n markerSize = 4,\n showCrosshairs = false,\n baselineCorrection = \"none\",\n baselineWindowSize = 50,\n peakDetectionOptions,\n showPeakAreas = false,\n boundaryMarkers = \"none\",\n annotationOverlapThreshold = 0.4,\n showExportButton = true,\n}) => {\n // Derive peak detection state from options\n const enablePeakDetection = peakDetectionOptions !== undefined;\n const plotRef = useRef<HTMLDivElement>(null);\n const theme = usePlotlyTheme();\n const { bindTooltip, tooltipElement } = useChartTooltip({\n xLabel: xAxisTitle,\n yLabel: yAxisTitle,\n });\n\n // Memoize processed series with baseline correction\n const processedSeries = useMemo(() => {\n return series.map((s) => {\n const validated = validateSeriesData(s.x, s.y);\n return {\n ...s,\n x: validated.x,\n y: applyBaselineCorrection(validated.y, baselineCorrection, baselineWindowSize),\n };\n });\n }, [series, baselineCorrection, baselineWindowSize]);\n\n // Process user annotations to convert startX/endX to indices and compute areas\n const processedAnnotations = useMemo(() => {\n if (annotations.length === 0 || processedSeries.length === 0) {\n return annotations;\n }\n // Use first series data for index lookup (user annotations apply to first series)\n const { x, y } = processedSeries[0];\n return processUserAnnotations(annotations, x, y);\n }, [annotations, processedSeries]);\n\n // Memoize peak detection results\n const allDetectedPeaks = useMemo(() => {\n const peaks: { peaks: PeakAnnotation[]; seriesIndex: number }[] = [];\n if (enablePeakDetection && peakDetectionOptions) {\n processedSeries.forEach((s, index) => {\n const detected = detectPeaks(s.x, s.y, peakDetectionOptions);\n if (detected.length > 0) {\n peaks.push({ peaks: detected, seriesIndex: index });\n }\n });\n }\n return peaks;\n }, [processedSeries, enablePeakDetection, peakDetectionOptions]);\n\n useEffect(() => {\n const currentRef = plotRef.current;\n if (!currentRef || series.length === 0) return;\n\n // Build trace data with auto-assigned colors\n const plotData: Plotly.Data[] = processedSeries.map((s, index) => {\n const traceColor = seriesColor(index, s.color);\n\n const trace: Plotly.Data = {\n x: s.x,\n y: s.y,\n type: \"scatter\" as const,\n mode: showMarkers ? \"lines+markers\" as const : \"lines\" as const,\n name: s.name,\n line: {\n color: traceColor,\n width: 1.5,\n },\n hoverinfo: \"none\" as const,\n };\n if (showMarkers) {\n trace.marker = {\n size: markerSize,\n color: traceColor,\n };\n }\n return trace;\n });\n\n // Add peak boundary markers if enabled\n if (boundaryMarkers !== \"none\") {\n const peaksWithData = collectPeaksWithBoundaryData(allDetectedPeaks, processedAnnotations, processedSeries);\n if (peaksWithData.length > 0) {\n const boundaryTraces = createBoundaryMarkerTraces(peaksWithData);\n plotData.push(...boundaryTraces);\n }\n }\n\n // Collect all peaks for unified staggering logic\n const allPeaksWithMeta: PeakWithMeta[] = [];\n\n // Add user-defined annotations (seriesIndex -1 indicates user-defined)\n processedAnnotations.forEach((ann) => {\n allPeaksWithMeta.push({ peak: ann, seriesIndex: -1 });\n });\n\n // Add auto-detected peaks if enabled\n if (showPeakAreas && enablePeakDetection) {\n allDetectedPeaks.forEach(({ peaks, seriesIndex }) => {\n peaks.forEach((peak) => {\n allPeaksWithMeta.push({ peak, seriesIndex });\n });\n });\n }\n\n // Group all overlapping peaks and create annotations with staggering\n const groups = groupOverlappingPeaks(allPeaksWithMeta, annotationOverlapThreshold);\n const plotlyAnnotations: Partial<Plotly.Annotations>[] = [];\n\n for (const group of groups) {\n plotlyAnnotations.push(...createGroupAnnotations(group));\n }\n\n const layout: Partial<Plotly.Layout> = {\n title: title\n ? {\n text: title,\n font: {\n size: 20,\n family: \"Inter, sans-serif\",\n color: theme.textColor,\n },\n }\n : undefined,\n width,\n height,\n margin: {\n l: CHROMATOGRAM_LAYOUT.MARGIN_LEFT,\n r: CHROMATOGRAM_LAYOUT.MARGIN_RIGHT,\n b: CHROMATOGRAM_LAYOUT.MARGIN_BOTTOM,\n t: title ? CHROMATOGRAM_LAYOUT.MARGIN_TOP_WITH_TITLE : CHROMATOGRAM_LAYOUT.MARGIN_TOP_NO_TITLE,\n pad: CHROMATOGRAM_LAYOUT.MARGIN_PAD,\n },\n paper_bgcolor: theme.paperBg,\n plot_bgcolor: theme.plotBg,\n font: { family: \"Inter, sans-serif\" },\n hovermode: showCrosshairs ? \"x\" as const : \"x unified\" as const,\n dragmode: \"zoom\" as const,\n xaxis: {\n title: {\n text: xAxisTitle,\n font: { size: 14, color: theme.textSecondary, family: \"Inter, sans-serif\" },\n standoff: 15,\n },\n showgrid: showGridX,\n gridcolor: theme.gridColor,\n linecolor: theme.lineColor,\n linewidth: 1,\n range: xRange,\n autorange: !xRange,\n zeroline: false,\n tickfont: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n showspikes: showCrosshairs,\n spikemode: \"across\" as const,\n spikesnap: \"cursor\" as const,\n spikecolor: theme.spikeColor,\n spikethickness: 1,\n spikedash: \"dot\" as const,\n },\n yaxis: {\n title: {\n text: yAxisTitle,\n font: { size: 14, color: theme.textSecondary, family: \"Inter, sans-serif\" },\n standoff: 10,\n },\n showgrid: showGridY,\n gridcolor: theme.gridColor,\n linecolor: theme.lineColor,\n linewidth: 1,\n range: yRange,\n autorange: !yRange,\n zeroline: false,\n tickfont: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n showspikes: showCrosshairs,\n spikemode: \"across\" as const,\n spikesnap: \"cursor\" as const,\n spikecolor: theme.spikeColor,\n spikethickness: 1,\n spikedash: \"dot\" as const,\n },\n legend: {\n x: 0.5,\n y: -0.15,\n xanchor: \"center\" as const,\n yanchor: \"top\" as const,\n orientation: \"h\" as const,\n font: { size: 12, color: theme.textColor, family: \"Inter, sans-serif\" },\n },\n showlegend: showLegend && series.length > 1,\n annotations: plotlyAnnotations,\n };\n\n const config: Partial<Plotly.Config> = {\n responsive: true,\n displayModeBar: true,\n displaylogo: false,\n modeBarButtonsToRemove: [\n \"lasso2d\",\n \"select2d\",\n ...(showExportButton ? [] : [\"toImage\"] as Plotly.ModeBarDefaultButtons[]),\n ] as Plotly.ModeBarDefaultButtons[],\n ...(showExportButton && {\n toImageButtonOptions: {\n format: \"png\",\n filename: \"chromatogram\",\n width: width,\n height: height,\n },\n }),\n };\n\n Plotly.newPlot(currentRef, plotData, layout, config);\n bindTooltip(currentRef);\n\n return () => {\n if (currentRef) {\n Plotly.purge(currentRef);\n }\n };\n }, [\n processedSeries, allDetectedPeaks, series.length, width, height, title, xAxisTitle, yAxisTitle,\n processedAnnotations, xRange, yRange, showLegend, showGridX, showGridY, showMarkers, markerSize,\n showCrosshairs, enablePeakDetection, peakDetectionOptions, showPeakAreas, boundaryMarkers,\n annotationOverlapThreshold, showExportButton, theme, bindTooltip,\n ]);\n\n return (\n <div className=\"chromatogram-chart-container relative\">\n <div ref={plotRef} style={{ width: \"100%\", height: \"100%\" }} />\n {tooltipElement}\n </div>\n );\n};\n\nexport { ChromatogramChart };\n\n"],"names":["EMPTY_ANNOTATIONS","ChromatogramChart","series","width","height","title","xAxisTitle","yAxisTitle","annotations","xRange","yRange","showLegend","showGridX","showGridY","showMarkers","markerSize","showCrosshairs","baselineCorrection","baselineWindowSize","peakDetectionOptions","showPeakAreas","boundaryMarkers","annotationOverlapThreshold","showExportButton","enablePeakDetection","plotRef","useRef","theme","usePlotlyTheme","bindTooltip","tooltipElement","useChartTooltip","processedSeries","useMemo","s","validated","validateSeriesData","applyBaselineCorrection","processedAnnotations","x","y","processUserAnnotations","allDetectedPeaks","peaks","index","detected","detectPeaks","useEffect","currentRef","plotData","traceColor","seriesColor","trace","peaksWithData","collectPeaksWithBoundaryData","boundaryTraces","createBoundaryMarkerTraces","allPeaksWithMeta","ann","seriesIndex","peak","groups","groupOverlappingPeaks","plotlyAnnotations","group","createGroupAnnotations","layout","CHROMATOGRAM_LAYOUT","config","Plotly","jsxs","jsx"],"mappings":"4cAgDMA,EAAsC,CAAA,EAEtCC,EAAsD,CAAC,CAC3D,OAAAC,EACA,MAAAC,EAAQ,IACR,OAAAC,EAAS,IACT,MAAAC,EACA,WAAAC,EAAa,uBACb,WAAAC,EAAa,eAAA,YACbC,EAAcR,EACd,OAAAS,EACA,OAAAC,EACA,WAAAC,EAAa,GACb,UAAAC,EAAY,GACZ,UAAAC,EAAY,GACZ,YAAAC,EAAc,GACd,WAAAC,EAAa,EACb,eAAAC,EAAiB,GACjB,mBAAAC,EAAqB,OACrB,mBAAAC,EAAqB,GACrB,qBAAAC,EACA,cAAAC,EAAgB,GAAA,gBAChBC,EAAkB,OAClB,2BAAAC,EAA6B,GAC7B,iBAAAC,EAAmB,EACrB,IAAM,CAEJ,MAAMC,EAAsBL,IAAyB,OAC/CM,EAAUC,EAAAA,OAAuB,IAAI,EACrCC,EAAQC,EAAAA,eAAA,EACR,CAAE,YAAAC,EAAa,eAAAC,CAAA,EAAmBC,kBAAgB,CACtD,OAAQzB,EACR,OAAQC,CAAA,CACT,EAGKyB,EAAkBC,EAAAA,QAAQ,IACvB/B,EAAO,IAAKgC,GAAM,CACvB,MAAMC,EAAYC,EAAAA,mBAAmBF,EAAE,EAAGA,EAAE,CAAC,EAC7C,MAAO,CACL,GAAGA,EACH,EAAGC,EAAU,EACb,EAAGE,EAAAA,wBAAwBF,EAAU,EAAGlB,EAAoBC,CAAkB,CAAA,CAElF,CA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