@tetrascience-npm/tetrascience-react-ui 0.6.0 → 0.7.0

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 (176) hide show
  1. package/README.md +55 -0
  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 +5 -5
  5. package/dist/components/ai/chain-of-thought.js.map +1 -1
  6. package/dist/components/ai/conversation.cjs +2 -2
  7. package/dist/components/ai/conversation.cjs.map +1 -1
  8. package/dist/components/ai/conversation.js +2 -2
  9. package/dist/components/ai/conversation.js.map +1 -1
  10. package/dist/components/ai/queue.cjs +1 -1
  11. package/dist/components/ai/queue.cjs.map +1 -1
  12. package/dist/components/ai/queue.js +9 -9
  13. package/dist/components/ai/queue.js.map +1 -1
  14. package/dist/components/charts/AreaGraph/AreaGraph.cjs +1 -1
  15. package/dist/components/charts/AreaGraph/AreaGraph.cjs.map +1 -1
  16. package/dist/components/charts/AreaGraph/AreaGraph.js +165 -103
  17. package/dist/components/charts/AreaGraph/AreaGraph.js.map +1 -1
  18. package/dist/components/charts/BarGraph/BarGraph.cjs +1 -1
  19. package/dist/components/charts/BarGraph/BarGraph.cjs.map +1 -1
  20. package/dist/components/charts/BarGraph/BarGraph.js +135 -90
  21. package/dist/components/charts/BarGraph/BarGraph.js.map +1 -1
  22. package/dist/components/charts/Boxplot/Boxplot.cjs +1 -1
  23. package/dist/components/charts/Boxplot/Boxplot.cjs.map +1 -1
  24. package/dist/components/charts/Boxplot/Boxplot.js +130 -92
  25. package/dist/components/charts/Boxplot/Boxplot.js.map +1 -1
  26. package/dist/components/charts/ChartTooltip/ChartTooltip.cjs +2 -0
  27. package/dist/components/charts/ChartTooltip/ChartTooltip.cjs.map +1 -0
  28. package/dist/components/charts/ChartTooltip/ChartTooltip.js +163 -0
  29. package/dist/components/charts/ChartTooltip/ChartTooltip.js.map +1 -0
  30. package/dist/components/charts/ChartTooltip/lines.cjs +2 -0
  31. package/dist/components/charts/ChartTooltip/lines.cjs.map +1 -0
  32. package/dist/components/charts/ChartTooltip/lines.js +29 -0
  33. package/dist/components/charts/ChartTooltip/lines.js.map +1 -0
  34. package/dist/components/charts/Chromatogram/Chromatogram.cjs +1 -1
  35. package/dist/components/charts/Chromatogram/Chromatogram.cjs.map +1 -1
  36. package/dist/components/charts/Chromatogram/Chromatogram.js +75 -61
  37. package/dist/components/charts/Chromatogram/Chromatogram.js.map +1 -1
  38. package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs +1 -1
  39. package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs.map +1 -1
  40. package/dist/components/charts/ChromatogramChart/ChromatogramChart.js +116 -108
  41. package/dist/components/charts/ChromatogramChart/ChromatogramChart.js.map +1 -1
  42. package/dist/components/charts/ChromatogramChart/annotations.cjs +1 -1
  43. package/dist/components/charts/ChromatogramChart/annotations.cjs.map +1 -1
  44. package/dist/components/charts/ChromatogramChart/annotations.js +32 -32
  45. package/dist/components/charts/ChromatogramChart/annotations.js.map +1 -1
  46. package/dist/components/charts/ChromatogramChart/boundaryMarkers.cjs +1 -1
  47. package/dist/components/charts/ChromatogramChart/boundaryMarkers.cjs.map +1 -1
  48. package/dist/components/charts/ChromatogramChart/boundaryMarkers.js +6 -6
  49. package/dist/components/charts/ChromatogramChart/boundaryMarkers.js.map +1 -1
  50. package/dist/components/charts/ChromatogramChart/constants.cjs +1 -1
  51. package/dist/components/charts/ChromatogramChart/constants.cjs.map +1 -1
  52. package/dist/components/charts/ChromatogramChart/constants.js +11 -5
  53. package/dist/components/charts/ChromatogramChart/constants.js.map +1 -1
  54. package/dist/components/charts/ChromatogramChart/dataProcessing.cjs +1 -1
  55. package/dist/components/charts/ChromatogramChart/dataProcessing.cjs.map +1 -1
  56. package/dist/components/charts/ChromatogramChart/dataProcessing.js +38 -49
  57. package/dist/components/charts/ChromatogramChart/dataProcessing.js.map +1 -1
  58. package/dist/components/charts/DotPlot/DotPlot.cjs +1 -1
  59. package/dist/components/charts/DotPlot/DotPlot.cjs.map +1 -1
  60. package/dist/components/charts/DotPlot/DotPlot.js +112 -88
  61. package/dist/components/charts/DotPlot/DotPlot.js.map +1 -1
  62. package/dist/components/charts/Histogram/Histogram.cjs +1 -1
  63. package/dist/components/charts/Histogram/Histogram.cjs.map +1 -1
  64. package/dist/components/charts/Histogram/Histogram.js +132 -115
  65. package/dist/components/charts/Histogram/Histogram.js.map +1 -1
  66. package/dist/components/charts/LineGraph/LineGraph.cjs +1 -1
  67. package/dist/components/charts/LineGraph/LineGraph.cjs.map +1 -1
  68. package/dist/components/charts/LineGraph/LineGraph.js +151 -111
  69. package/dist/components/charts/LineGraph/LineGraph.js.map +1 -1
  70. package/dist/components/charts/PieChart/PieChart.cjs +1 -1
  71. package/dist/components/charts/PieChart/PieChart.cjs.map +1 -1
  72. package/dist/components/charts/PieChart/PieChart.js +81 -70
  73. package/dist/components/charts/PieChart/PieChart.js.map +1 -1
  74. package/dist/components/charts/PlateMap/PlateMap.cjs +1 -1
  75. package/dist/components/charts/PlateMap/PlateMap.cjs.map +1 -1
  76. package/dist/components/charts/PlateMap/PlateMap.js +271 -256
  77. package/dist/components/charts/PlateMap/PlateMap.js.map +1 -1
  78. package/dist/components/charts/PlateMap/constants.cjs +1 -1
  79. package/dist/components/charts/PlateMap/constants.cjs.map +1 -1
  80. package/dist/components/charts/PlateMap/constants.js +20 -29
  81. package/dist/components/charts/PlateMap/constants.js.map +1 -1
  82. package/dist/components/charts/ScatterGraph/ScatterGraph.cjs +1 -1
  83. package/dist/components/charts/ScatterGraph/ScatterGraph.cjs.map +1 -1
  84. package/dist/components/charts/ScatterGraph/ScatterGraph.js +154 -106
  85. package/dist/components/charts/ScatterGraph/ScatterGraph.js.map +1 -1
  86. package/dist/components/composed/DataAppShell/DataAppShell.cjs +1 -1
  87. package/dist/components/composed/DataAppShell/DataAppShell.cjs.map +1 -1
  88. package/dist/components/composed/DataAppShell/DataAppShell.js +118 -111
  89. package/dist/components/composed/DataAppShell/DataAppShell.js.map +1 -1
  90. package/dist/components/composed/PlateMapEditor/PlateMapGrid.cjs +1 -1
  91. package/dist/components/composed/PlateMapEditor/PlateMapGrid.cjs.map +1 -1
  92. package/dist/components/composed/PlateMapEditor/PlateMapGrid.js +1 -1
  93. package/dist/components/composed/PlateMapEditor/PlateMapGrid.js.map +1 -1
  94. package/dist/components/composed/PlateMapEditor/WellLegend.cjs +1 -1
  95. package/dist/components/composed/PlateMapEditor/WellLegend.cjs.map +1 -1
  96. package/dist/components/composed/PlateMapEditor/WellLegend.js +8 -8
  97. package/dist/components/composed/PlateMapEditor/WellLegend.js.map +1 -1
  98. package/dist/components/composed/RichListItem/RichListItem.cjs +1 -1
  99. package/dist/components/composed/RichListItem/RichListItem.cjs.map +1 -1
  100. package/dist/components/composed/RichListItem/RichListItem.js +16 -16
  101. package/dist/components/composed/RichListItem/RichListItem.js.map +1 -1
  102. package/dist/components/ui/accordion.cjs +1 -1
  103. package/dist/components/ui/accordion.cjs.map +1 -1
  104. package/dist/components/ui/accordion.js +1 -1
  105. package/dist/components/ui/accordion.js.map +1 -1
  106. package/dist/components/ui/badge.cjs +1 -1
  107. package/dist/components/ui/badge.cjs.map +1 -1
  108. package/dist/components/ui/badge.js +8 -8
  109. package/dist/components/ui/badge.js.map +1 -1
  110. package/dist/components/ui/button.cjs +1 -1
  111. package/dist/components/ui/button.cjs.map +1 -1
  112. package/dist/components/ui/button.js +11 -11
  113. package/dist/components/ui/button.js.map +1 -1
  114. package/dist/components/ui/combobox.cjs +1 -1
  115. package/dist/components/ui/combobox.cjs.map +1 -1
  116. package/dist/components/ui/combobox.js +12 -12
  117. package/dist/components/ui/combobox.js.map +1 -1
  118. package/dist/components/ui/input-group.cjs +1 -1
  119. package/dist/components/ui/input-group.cjs.map +1 -1
  120. package/dist/components/ui/input-group.js +19 -19
  121. package/dist/components/ui/input-group.js.map +1 -1
  122. package/dist/components/ui/item.cjs +1 -1
  123. package/dist/components/ui/item.cjs.map +1 -1
  124. package/dist/components/ui/item.js +1 -1
  125. package/dist/components/ui/item.js.map +1 -1
  126. package/dist/components/ui/menubar.cjs +1 -1
  127. package/dist/components/ui/menubar.cjs.map +1 -1
  128. package/dist/components/ui/menubar.js +1 -1
  129. package/dist/components/ui/menubar.js.map +1 -1
  130. package/dist/components/ui/navigation-menu.cjs +1 -1
  131. package/dist/components/ui/navigation-menu.cjs.map +1 -1
  132. package/dist/components/ui/navigation-menu.js +54 -54
  133. package/dist/components/ui/navigation-menu.js.map +1 -1
  134. package/dist/components/ui/resizable.cjs +1 -1
  135. package/dist/components/ui/resizable.cjs.map +1 -1
  136. package/dist/components/ui/resizable.js +27 -15
  137. package/dist/components/ui/resizable.js.map +1 -1
  138. package/dist/components/ui/select.cjs +1 -1
  139. package/dist/components/ui/select.cjs.map +1 -1
  140. package/dist/components/ui/select.js +1 -1
  141. package/dist/components/ui/select.js.map +1 -1
  142. package/dist/components/ui/slider.cjs +1 -1
  143. package/dist/components/ui/slider.cjs.map +1 -1
  144. package/dist/components/ui/slider.js +9 -9
  145. package/dist/components/ui/slider.js.map +1 -1
  146. package/dist/components/ui/table.cjs +1 -1
  147. package/dist/components/ui/table.cjs.map +1 -1
  148. package/dist/components/ui/table.js +13 -13
  149. package/dist/components/ui/table.js.map +1 -1
  150. package/dist/components/ui/tabs.cjs +1 -1
  151. package/dist/components/ui/tabs.cjs.map +1 -1
  152. package/dist/components/ui/tabs.js +7 -7
  153. package/dist/components/ui/tabs.js.map +1 -1
  154. package/dist/components/ui/toggle.cjs +1 -1
  155. package/dist/components/ui/toggle.cjs.map +1 -1
  156. package/dist/components/ui/toggle.js +12 -12
  157. package/dist/components/ui/toggle.js.map +1 -1
  158. package/dist/hooks/use-element-size.cjs +2 -0
  159. package/dist/hooks/use-element-size.cjs.map +1 -0
  160. package/dist/hooks/use-element-size.js +21 -0
  161. package/dist/hooks/use-element-size.js.map +1 -0
  162. package/dist/hooks/use-plotly-theme.cjs +1 -1
  163. package/dist/hooks/use-plotly-theme.cjs.map +1 -1
  164. package/dist/hooks/use-plotly-theme.js +4 -2
  165. package/dist/hooks/use-plotly-theme.js.map +1 -1
  166. package/dist/index.cjs +1 -1
  167. package/dist/index.css +1 -1
  168. package/dist/index.d.ts +254 -77
  169. package/dist/index.js +587 -581
  170. package/dist/index.js.map +1 -1
  171. package/dist/index.tailwind.css +1 -1
  172. package/dist/utils/colors.cjs +1 -1
  173. package/dist/utils/colors.cjs.map +1 -1
  174. package/dist/utils/colors.js +38 -93
  175. package/dist/utils/colors.js.map +1 -1
  176. package/package.json +18 -12
@@ -1 +1 @@
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 { usePlotlyTheme } from \"@/hooks/use-plotly-theme\";\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 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 width?: number;\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 = 1000,\n height = 600,\n xRange,\n yRange,\n xTitle = \"Columns\",\n yTitle = \"Rows\",\n title = \"Boxplot\",\n showPoints = false,\n}) => {\n const plotRef = useRef<HTMLDivElement>(null);\n const theme = usePlotlyTheme();\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) return;\n\n const data = dataSeries.map((series) => ({\n y: series.y,\n x: series.x,\n type: \"box\" as const,\n name: series.name,\n marker: {\n color: series.color,\n },\n line: {\n color: series.color,\n },\n fillcolor: series.color + \"40\", // Add transparency\n boxpoints: showPoints ? series.boxpoints || \"outliers\" : (false as const),\n jitter: series.jitter || 0.3,\n pointpos: series.pointpos || DEFAULT_POINT_POSITION,\n }));\n\n const layout = {\n width,\n height: height,\n title: titleOptions,\n margin: { l: 80, r: 40, b: 80, 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 ...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 ...tickOptions,\n },\n legend: {\n x: 0.5,\n y: -0.2,\n xanchor: \"center\" as const,\n yanchor: \"top\" 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 responsive: true,\n displayModeBar: false,\n displaylogo: false,\n };\n\n Plotly.newPlot(plotRef.current, data, layout, config);\n\n // Capture ref value for cleanup\n const plotElement = plotRef.current;\n\n // Cleanup function\n return () => {\n if (plotElement) {\n Plotly.purge(plotElement);\n }\n };\n }, [dataSeries, width, height, xRange, yRange, effectiveYRange, xTitle, yTitle, showPoints, titleOptions, tickOptions, yTicks, theme]);\n\n return (\n <div className=\"boxplot-container\">\n <div ref={plotRef} style={{ width: \"100%\", height: \"100%\" }} />\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","yMin","yMax","useMemo","minY","maxY","series","y","yPadding","effectiveYRange","yTicks","range","step","ticks","current","tickOptions","titleOptions","useEffect","data","layout","config","Plotly","plotElement","jsx"],"mappings":"qNAMMA,EAAyB,KAwBzBC,EAAkC,CAAC,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L,MAAO,CACL,MAAO,CACL,KAAMrB,EACN,KAAM,CACJ,KAAM,GACN,MAAOK,EAAM,cACb,OAAQ,oBACR,OAAQ,GAAA,EAEV,SAAU,EAAA,EAEZ,UAAWA,EAAM,UACjB,MAAOP,EACP,UAAW,CAACA,EACZ,SAAU,QACV,SAAUkB,EACV,SAAU,GACV,GAAGK,CAAA,EAEL,OAAQ,CACN,EAAG,GACH,EAAG,IACH,QAAS,SACT,QAAS,MACT,YAAa,IACb,KAAM,CACJ,KAAM,GACN,MAAOhB,EAAM,YACb,OAAQ,oBACR,OAAQ,IACR,WAAY,EAAA,CACd,EAEF,WAAY,EAAA,EAGRqB,EAAS,CACb,WAAY,GACZ,eAAgB,GAChB,YAAa,EAAA,EAGfC,EAAO,QAAQxB,EAAQ,QAASqB,EAAMC,EAAQC,CAAM,EAGpD,MAAME,EAAczB,EAAQ,QAG5B,MAAO,IAAM,CACPyB,GACFD,EAAO,MAAMC,CAAW,CAE5B,CACF,EAAG,CAAClC,EAAYC,EAAOC,EAAQC,EAAQC,EAAQiB,EAAiBhB,EAAQC,EAAQE,EAAYoB,EAAcD,EAAaL,EAAQX,CAAK,CAAC,EAGnIwB,EAAAA,IAAC,MAAA,CAAI,UAAU,oBACb,eAAC,MAAA,CAAI,IAAK1B,EAAS,MAAO,CAAE,MAAO,OAAQ,OAAQ,MAAA,EAAU,EAC/D,CAEJ"}
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,EAC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AAQ,QAC5B,OAAAgB,EAAc,QAAU,GACxBC,EAAe,QAAU,CAAE,GAAGF,EAAQ,OAAA,EAG/B,IAAM,CACP2B,IACFD,EAAO,MAAMC,CAAW,EACxB1B,EAAc,QAAU,GAE5B,CACF,EAAG,CAACzB,EAAYqB,EAASlB,EAAQC,EAAQ+B,EAAiB9B,EAAQC,EAAQE,EAAYkC,EAAcD,EAAaL,EAAQzB,EAAOE,CAAW,CAAC,EAI5I8B,EAAAA,UAAU,IAAM,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,63 +1,69 @@
1
- import { jsx as b } from "react/jsx-runtime";
2
- import C from "plotly.js-dist";
3
- import { useRef as E, useMemo as s, useEffect as z } from "react";
4
- import { usePlotlyTheme as N } from "../../../hooks/use-plotly-theme.js";
5
- const _ = -1.8, A = ({
6
- dataSeries: a,
7
- width: h = 1e3,
8
- height: u = 600,
9
- xRange: p,
10
- yRange: c,
11
- xTitle: d = "Columns",
12
- yTitle: g = "Rows",
13
- title: x = "Boxplot",
14
- showPoints: y = !1
1
+ import { jsxs as Y, jsx as H } from "react/jsx-runtime";
2
+ import k from "plotly.js-dist";
3
+ import { useRef as g, useMemo as u, useEffect as j } from "react";
4
+ import { useChartTooltip as V } from "../ChartTooltip/ChartTooltip.js";
5
+ import { useElementSize as D } from "../../../hooks/use-element-size.js";
6
+ import { usePlotlyTheme as F } from "../../../hooks/use-plotly-theme.js";
7
+ import { cn as R } from "../../../lib/utils.js";
8
+ import { seriesColor as X } from "../../../utils/colors.js";
9
+ const $ = -1.8, et = ({
10
+ dataSeries: p,
11
+ width: v,
12
+ height: I,
13
+ xRange: y,
14
+ yRange: h,
15
+ xTitle: x,
16
+ yTitle: w,
17
+ title: z = "Boxplot",
18
+ showPoints: E = !1
15
19
  }) => {
16
- const f = E(null), t = N(), { yMin: M, yMax: w } = s(() => {
17
- let r = Number.MAX_VALUE, o = Number.MIN_VALUE;
18
- a.forEach((n) => {
19
- n.y.forEach((e) => {
20
- r = Math.min(r, e), o = Math.max(o, e);
20
+ const a = g(null), o = F(), { bindTooltip: C, tooltipElement: A } = V({ xLabel: x, yLabel: w }), [S, N] = D(), n = v ?? N.width, i = I ?? N.height, _ = n > 0 && i > 0, T = v === void 0, U = I === void 0, d = g({ width: n, height: i });
21
+ d.current = { width: n, height: i };
22
+ const M = g(!1), m = g({ width: 0, height: 0 }), { yMin: B, yMax: L } = u(() => {
23
+ let e = Number.MAX_VALUE, t = Number.MIN_VALUE;
24
+ p.forEach((l) => {
25
+ l.y.forEach((r) => {
26
+ e = Math.min(e, r), t = Math.max(t, r);
21
27
  });
22
28
  });
23
- const l = (o - r) * 0.1;
29
+ const c = (t - e) * 0.1;
24
30
  return {
25
- yMin: r - l,
26
- yMax: o + l
31
+ yMin: e - c,
32
+ yMax: t + c
27
33
  };
28
- }, [a]), i = s(
29
- () => c || [M, w],
30
- [c, M, w]
31
- ), k = s(() => {
32
- const r = i[1] - i[0];
33
- let o = Math.pow(10, Math.floor(Math.log10(r)));
34
- r / o > 10 && (o = o * 2), r / o < 4 && (o = o / 2);
35
- const l = [];
36
- let n = Math.ceil(i[0] / o) * o;
37
- for (; n <= i[1]; )
38
- l.push(n), n += o;
39
- return l;
40
- }, [i]), m = s(
34
+ }, [p]), f = u(
35
+ () => h || [B, L],
36
+ [h, B, L]
37
+ ), O = u(() => {
38
+ const e = f[1] - f[0];
39
+ let t = Math.pow(10, Math.floor(Math.log10(e)));
40
+ e / t > 10 && (t = t * 2), e / t < 4 && (t = t / 2);
41
+ const c = [];
42
+ let l = Math.ceil(f[0] / t) * t;
43
+ for (; l <= f[1]; )
44
+ c.push(l), l += t;
45
+ return c;
46
+ }, [f]), b = u(
41
47
  () => ({
42
- tickcolor: t.tickColor,
48
+ tickcolor: o.tickColor,
43
49
  ticklen: 12,
44
50
  tickwidth: 1,
45
51
  ticks: "outside",
46
52
  tickfont: {
47
53
  size: 16,
48
- color: t.textColor,
54
+ color: o.textColor,
49
55
  family: "Inter, sans-serif",
50
56
  weight: 400
51
57
  },
52
- linecolor: t.lineColor,
58
+ linecolor: o.lineColor,
53
59
  linewidth: 1,
54
60
  position: 0,
55
61
  zeroline: !1
56
62
  }),
57
- [t]
58
- ), I = s(
63
+ [o]
64
+ ), P = u(
59
65
  () => ({
60
- text: x,
66
+ text: z,
61
67
  x: 0.5,
62
68
  y: 0.95,
63
69
  xanchor: "center",
@@ -66,106 +72,138 @@ const _ = -1.8, A = ({
66
72
  size: 32,
67
73
  weight: 600,
68
74
  family: "Inter, sans-serif",
69
- color: t.textColor,
75
+ color: o.textColor,
70
76
  lineheight: 1.2,
71
77
  standoff: 30
72
78
  }
73
79
  }),
74
- [x, t]
80
+ [z, o]
75
81
  );
76
- return z(() => {
77
- if (!f.current) return;
78
- const r = a.map((e) => ({
79
- y: e.y,
80
- x: e.x,
81
- type: "box",
82
- name: e.name,
83
- marker: {
84
- color: e.color
85
- },
86
- line: {
87
- color: e.color
88
- },
89
- fillcolor: e.color + "40",
90
- // Add transparency
91
- boxpoints: y ? e.boxpoints || "outliers" : !1,
92
- jitter: e.jitter || 0.3,
93
- pointpos: e.pointpos || _
94
- })), o = {
95
- width: h,
96
- height: u,
97
- title: I,
98
- margin: { l: 80, r: 40, b: 80, t: 80, pad: 0 },
99
- paper_bgcolor: t.paperBg,
100
- plot_bgcolor: t.plotBg,
82
+ return j(() => {
83
+ if (!a.current || !_) return;
84
+ const e = p.map((r, W) => {
85
+ const s = X(W, r.color);
86
+ return {
87
+ y: r.y,
88
+ x: r.x,
89
+ type: "box",
90
+ name: r.name,
91
+ hoverinfo: "none",
92
+ marker: {
93
+ color: s
94
+ },
95
+ line: {
96
+ color: s
97
+ },
98
+ fillcolor: typeof s == "string" && s.startsWith("#") && s.length === 7 ? `${s}40` : s,
99
+ // Add transparency for hex colors only
100
+ boxpoints: E ? r.boxpoints || "outliers" : !1,
101
+ jitter: r.jitter || 0.3,
102
+ pointpos: r.pointpos || $
103
+ };
104
+ }), t = {
105
+ width: d.current.width,
106
+ height: d.current.height,
107
+ title: P,
108
+ // Bottom margin reserves room for tick labels, the x-axis title, and the
109
+ // container-anchored bottom legend stacked beneath them.
110
+ margin: { l: 80, r: 40, b: 96, t: 80, pad: 0 },
111
+ paper_bgcolor: o.paperBg,
112
+ plot_bgcolor: o.plotBg,
101
113
  font: {
102
114
  family: "Inter, sans-serif"
103
115
  },
104
116
  dragmode: !1,
105
117
  xaxis: {
106
118
  title: {
107
- text: d,
119
+ text: x,
108
120
  font: {
109
121
  size: 16,
110
- color: t.textSecondary,
122
+ color: o.textSecondary,
111
123
  family: "Inter, sans-serif",
112
124
  weight: 400
113
125
  },
114
126
  standoff: 15
115
127
  },
116
- gridcolor: t.gridColor,
117
- range: p,
118
- autorange: !p,
128
+ gridcolor: o.gridColor,
129
+ range: y,
130
+ autorange: !y,
119
131
  showgrid: !0,
120
- ...m
132
+ // Reserve space for tick labels + the axis title so the bottom legend
133
+ // can't overlap them at small sizes (SW-2157).
134
+ automargin: !0,
135
+ ...b
121
136
  },
122
137
  yaxis: {
123
138
  title: {
124
- text: g,
139
+ text: w,
125
140
  font: {
126
141
  size: 16,
127
- color: t.textSecondary,
142
+ color: o.textSecondary,
128
143
  family: "Inter, sans-serif",
129
144
  weight: 400
130
145
  },
131
146
  standoff: 15
132
147
  },
133
- gridcolor: t.gridColor,
134
- range: c,
135
- autorange: !c,
148
+ gridcolor: o.gridColor,
149
+ range: h,
150
+ autorange: !h,
136
151
  tickmode: "array",
137
- tickvals: k,
152
+ tickvals: O,
138
153
  showgrid: !0,
139
- ...m
154
+ automargin: !0,
155
+ ...b
140
156
  },
141
157
  legend: {
158
+ // Anchor to the bottom of the container (not the plot area) so the
159
+ // legend always clears the x-axis tick labels + title — a paper-relative
160
+ // fractional offset collapses into the ticks at small heights (SW-2157).
142
161
  x: 0.5,
143
- y: -0.2,
162
+ y: 0,
144
163
  xanchor: "center",
145
- yanchor: "top",
164
+ yanchor: "bottom",
165
+ yref: "container",
146
166
  orientation: "h",
147
167
  font: {
148
168
  size: 13,
149
- color: t.legendColor,
169
+ color: o.legendColor,
150
170
  family: "Inter, sans-serif",
151
171
  weight: 500,
152
172
  lineheight: 18
153
173
  }
154
174
  },
155
175
  showlegend: !0
156
- }, l = {
157
- responsive: !0,
176
+ }, c = {
177
+ // Sizing is driven from the measured container; disable Plotly's own
178
+ // window-resize responsiveness (it can't see container resizes).
179
+ responsive: !1,
158
180
  displayModeBar: !1,
159
181
  displaylogo: !1
160
182
  };
161
- C.newPlot(f.current, r, o, l);
162
- const n = f.current;
163
- return () => {
164
- n && C.purge(n);
183
+ k.newPlot(a.current, e, t, c), C(a.current);
184
+ const l = a.current;
185
+ return M.current = !0, m.current = { ...d.current }, () => {
186
+ l && (k.purge(l), M.current = !1);
165
187
  };
166
- }, [a, h, u, p, c, i, d, g, y, I, m, k, t]), /* @__PURE__ */ b("div", { className: "boxplot-container", children: /* @__PURE__ */ b("div", { ref: f, style: { width: "100%", height: "100%" } }) });
188
+ }, [p, _, y, h, f, x, w, E, P, b, O, o, C]), j(() => {
189
+ const e = a.current;
190
+ !e || !M.current || n <= 0 || i <= 0 || m.current.width === n && m.current.height === i || (m.current = { width: n, height: i }, k.relayout(e, { width: n, height: i }).catch(
191
+ () => {
192
+ }
193
+ ));
194
+ }, [n, i]), /* @__PURE__ */ Y(
195
+ "div",
196
+ {
197
+ ref: S,
198
+ className: R("boxplot-container relative", T && "w-full", U && "h-full"),
199
+ children: [
200
+ /* @__PURE__ */ H("div", { ref: a, style: { width: "100%", height: "100%" } }),
201
+ A
202
+ ]
203
+ }
204
+ );
167
205
  };
168
206
  export {
169
- A as Boxplot
207
+ et as Boxplot
170
208
  };
171
209
  //# sourceMappingURL=Boxplot.js.map
@@ -1 +1 @@
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 { usePlotlyTheme } from \"@/hooks/use-plotly-theme\";\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 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 width?: number;\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 = 1000,\n height = 600,\n xRange,\n yRange,\n xTitle = \"Columns\",\n yTitle = \"Rows\",\n title = \"Boxplot\",\n showPoints = false,\n}) => {\n const plotRef = useRef<HTMLDivElement>(null);\n const theme = usePlotlyTheme();\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) return;\n\n const data = dataSeries.map((series) => ({\n y: series.y,\n x: series.x,\n type: \"box\" as const,\n name: series.name,\n marker: {\n color: series.color,\n },\n line: {\n color: series.color,\n },\n fillcolor: series.color + \"40\", // Add transparency\n boxpoints: showPoints ? series.boxpoints || \"outliers\" : (false as const),\n jitter: series.jitter || 0.3,\n pointpos: series.pointpos || DEFAULT_POINT_POSITION,\n }));\n\n const layout = {\n width,\n height: height,\n title: titleOptions,\n margin: { l: 80, r: 40, b: 80, 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 ...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 ...tickOptions,\n },\n legend: {\n x: 0.5,\n y: -0.2,\n xanchor: \"center\" as const,\n yanchor: \"top\" 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 responsive: true,\n displayModeBar: false,\n displaylogo: false,\n };\n\n Plotly.newPlot(plotRef.current, data, layout, config);\n\n // Capture ref value for cleanup\n const plotElement = plotRef.current;\n\n // Cleanup function\n return () => {\n if (plotElement) {\n Plotly.purge(plotElement);\n }\n };\n }, [dataSeries, width, height, xRange, yRange, effectiveYRange, xTitle, yTitle, showPoints, titleOptions, tickOptions, yTicks, theme]);\n\n return (\n <div className=\"boxplot-container\">\n <div ref={plotRef} style={{ width: \"100%\", height: \"100%\" }} />\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","yMin","yMax","useMemo","minY","maxY","series","y","yPadding","effectiveYRange","yTicks","range","step","ticks","current","tickOptions","titleOptions","useEffect","data","layout","config","Plotly","plotElement","jsx"],"mappings":";;;;AAMA,MAAMA,IAAyB,MAwBzBC,IAAkC,CAAC;AAAA,E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B,aAAa;AAAA,IAAA;AAGf,IAAAC,EAAO,QAAQxB,EAAQ,SAASqB,GAAMC,GAAQC,CAAM;AAGpD,UAAME,IAAczB,EAAQ;AAG5B,WAAO,MAAM;AACX,MAAIyB,KACFD,EAAO,MAAMC,CAAW;AAAA,IAE5B;AAAA,EACF,GAAG,CAAClC,GAAYC,GAAOC,GAAQC,GAAQC,GAAQiB,GAAiBhB,GAAQC,GAAQE,GAAYoB,GAAcD,GAAaL,GAAQX,CAAK,CAAC,GAGnI,gBAAAwB,EAAC,OAAA,EAAI,WAAU,qBACb,4BAAC,OAAA,EAAI,KAAK1B,GAAS,OAAO,EAAE,OAAO,QAAQ,QAAQ,OAAA,GAAU,GAC/D;AAEJ;"}
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,EAAE,QAAQV,GAAQ,QAAQC,GAAQ,GAIpF,CAACU,GAAcC,CAAQ,IAAIC,EAAA,GAC3BC,IAAgBlB,KAASgB,EAAS,OAClCG,IAAiBlB,KAAUe,EAAS,QACpCI,IAAUF,IAAg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8B/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;"}
@@ -0,0 +1,2 @@
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const m=require("react/jsx-runtime"),j=require("plotly.js-dist"),u=require("react"),O=require("react-dom"),A=require("./lines.cjs"),L=require("../../../lib/utils.cjs"),X=20,q=150,H=200,y=8,W=10,I={top:"bottom",bottom:"top",left:"right",right:"left"},z={top:{wrapper:"-translate-x-1/2 -translate-y-[calc(100%+10px)]",arrow:"-bottom-1 left-1/2 -translate-x-1/2"},bottom:{wrapper:"-translate-x-1/2 translate-y-[10px]",arrow:"-top-1 left-1/2 -translate-x-1/2"},left:{wrapper:"-translate-y-1/2 -translate-x-[calc(100%+10px)]",arrow:"-right-1 top-1/2 -translate-y-1/2"},right:{wrapper:"-translate-y-1/2 translate-x-[10px]",arrow:"-left-1 top-1/2 -translate-y-1/2"}},k=(t,o,n,r)=>{const e=y,s=W,i={top:o.top-s-r>=e,bottom:o.top+s+r<=window.innerHeight-e,left:o.left-s-n>=e,right:o.left+s+n<=window.innerWidth-e};return!i[t]&&i[I[t]]?I[t]:t};function N({anchor:t,bubbleRef:o}){const n=u.useRef(null),r=t?.side??"top",[e,s]=u.useState(r),i=u.useCallback(l=>{n.current=l,typeof o=="function"?o(l):o&&(o.current=l)},[o]);if(u.useLayoutEffect(()=>{const l=n.current;if(!t||!l)return;const c=k(r,t,l.offsetWidth,l.offsetHeight);s(x=>x===c?x:c)},[t,r]),!t)return null;const p=z[e];return O.createPortal(m.jsx("div",{"data-slot":"chart-tooltip-anchor",className:"pointer-events-none fixed z-50",style:{left:t.left,top:t.top},children:m.jsx("div",{ref:i,className:L.cn("w-max",p.wrapper),children:m.jsxs("div",{role:"tooltip","data-slot":"tooltip-content","data-side":e,className:L.cn("relative w-fit max-w-xs rounded-md bg-foreground px-3 py-1.5 text-xs text-background",t.closing?"animate-out fade-out zoom-out-95 fill-mode-forwards":"animate-in fade-in-0 zoom-in-95"),children:[t.lines.map((l,c)=>m.jsx("div",{children:l},`${c}-${l}`)),m.jsx("span",{"aria-hidden":!0,className:L.cn("absolute size-2.5 rotate-45 rounded-[2px] bg-foreground",p.arrow)})]})})}),document.body)}const G=(t,o,n,r)=>{const e=n/2,s=Math.min(Math.max(t,e+y),window.innerWidth-e-y),i=Math.min(Math.max(o,r+10+y),window.innerHeight-y);return{left:s,top:i}};function Y(t={}){const[o,n]=u.useState(null),r=u.useRef(void 0),e=u.useRef(t);e.current=t;const s=u.useRef(null),i=u.useRef(null),p=u.useRef(null);return{bindTooltip:u.useCallback(c=>{if(!c)return;p.current?.(),p.current=null,n(null),i.current=null,j.relayout(c,{hoverdistance:e.current.hoverDistance??X});const x=c,M=(a,f,w)=>{const T=s.current,{left:v,top:R}=G(f,w,T?.offsetWidth??0,T?.offsetHeight??0);n({left:v,top:R,lines:a,side:e.current.side})};x.on("plotly_hover",a=>{const f=a.points??[],{getLines:w,xLabel:T,yLabel:v,followCursor:R}=e.current,g=w?w(f):A.chartTooltipLines(f,{xLabel:T,yLabel:v});if(g.length===0)return;clearTimeout(r.current);const h=a.event;if(R){i.current=g,M(g,h?.clientX??0,h?.clientY??0);return}const b=f[0],d=b?.bbox;let E=0,S=0;if(d){const C=c.getBoundingClientRect();E=C.left+(d.x0+d.x1)/2;const _=b?.yaxis;d.y0===d.y1&&typeof b?.y=="number"&&typeof _?.l2p=="function"&&typeof _._offset=="number"?S=C.top+_._offset+_.l2p(b.y):S=C.top+Math.min(d.y0,d.y1)}else h&&(E=h.clientX,S=h.clientY);n({left:E,top:S,lines:g,side:e.current.side})});const P=a=>{if(!e.current.followCursor)return;const f=i.current;f&&M(f,a.clientX,a.clientY)};c.addEventListener("mousemove",P),p.current=()=>c.removeEventListener("mousemove",P),x.on("plotly_unhover",()=>{clearTimeout(r.current),i.current=null,r.current=setTimeout(()=>{n(a=>a&&{...a,closing:!0}),r.current=setTimeout(()=>n(null),H)},q)})},[]),tooltipElement:m.jsx(N,{anchor:o,bubbleRef:s})}}exports.chartTooltipLines=A.chartTooltipLines;exports.ChartTooltip=N;exports.useChartTooltip=Y;
2
+ //# sourceMappingURL=ChartTooltip.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ChartTooltip.cjs","sources":["../../../../src/components/charts/ChartTooltip/ChartTooltip.tsx"],"sourcesContent":["import Plotly from \"plotly.js-dist\";\nimport { useCallback, useLayoutEffect, useRef, useState } from \"react\";\nimport { createPortal } from \"react-dom\";\n\nimport { chartTooltipLines } from \"./lines\";\n\nimport type { ChartTooltipHoverPoint } from \"./lines\";\nimport type { Ref } from \"react\";\n\nimport { cn } from \"@/lib/utils\";\n\nexport { chartTooltipLines } from \"./lines\";\nexport type { ChartTooltipHoverPoint } from \"./lines\";\n\n/**\n * How far (px) from a point Plotly still reports a hover. Matches Plotly's\n * default — a larger radius makes tooltips snap to neighbors in dense plots\n */\nconst HOVER_DISTANCE_PX = 20;\n/** Grace period before hiding, so the tooltip survives gaps between points */\nconst HIDE_GRACE_MS = 150;\n/** How long the exit animation plays before the tooltip unmounts */\nconst EXIT_ANIMATION_MS = 200;\n\n/** Which edge of the point the tooltip is placed against (matches Radix). */\nexport type ChartTooltipSide = \"top\" | \"bottom\" | \"left\" | \"right\";\n\nexport interface ChartTooltipAnchor {\n left: number;\n top: number;\n lines: string[];\n /** Preferred placement side; auto-flips to the opposite when it won't fit */\n side?: ChartTooltipSide;\n /** Plays the exit animation before the tooltip unmounts */\n closing?: boolean;\n}\n\n/** Keep an anchor point this far from the viewport edges when clamping */\nconst VIEWPORT_PADDING_PX = 8;\n/** Gap (px) between the anchor point and the bubble on every side */\nconst TOOLTIP_GAP_PX = 10;\n\n/** The opposite side to flip to when the preferred one has no room */\nconst OPPOSITE_SIDE: Record<ChartTooltipSide, ChartTooltipSide> = {\n top: \"bottom\",\n bottom: \"top\",\n left: \"right\",\n right: \"left\",\n};\n\n/**\n * Per-side transforms. The wrapper carries positioning transforms (kept off\n * the bubble so they don't clobber the entry/exit animation), and the arrow\n * sits on the edge facing the point.\n */\nconst SIDE_CLASSES: Record<ChartTooltipSide, { wrapper: string; arrow: string }> = {\n top: {\n wrapper: \"-translate-x-1/2 -translate-y-[calc(100%+10px)]\",\n arrow: \"-bottom-1 left-1/2 -translate-x-1/2\",\n },\n bottom: {\n wrapper: \"-translate-x-1/2 translate-y-[10px]\",\n arrow: \"-top-1 left-1/2 -translate-x-1/2\",\n },\n left: {\n wrapper: \"-translate-y-1/2 -translate-x-[calc(100%+10px)]\",\n arrow: \"-right-1 top-1/2 -translate-y-1/2\",\n },\n right: {\n wrapper: \"-translate-y-1/2 translate-x-[10px]\",\n arrow: \"-left-1 top-1/2 -translate-y-1/2\",\n },\n};\n\ninterface ChartTooltipEmitter {\n on: (event: string, handler: (data: ChartTooltipHoverEvent) => void) => void;\n}\n\ninterface ChartTooltipHoverEvent {\n points?: ChartTooltipHoverPoint[];\n event?: MouseEvent;\n}\n\nexport interface ChartTooltipProps {\n /** Anchor position (viewport coordinates) and content lines */\n anchor: ChartTooltipAnchor | null;\n /** Ref to the bubble node, used by cursor-following charts to clamp it on-screen */\n bubbleRef?: Ref<HTMLDivElement>;\n}\n\n/**\n * Resolve the side the bubble actually renders on: keep the preferred side\n * when it fits in the viewport, otherwise flip to the opposite side.\n */\nconst resolveSide = (\n preferred: ChartTooltipSide,\n anchor: { left: number; top: number },\n width: number,\n height: number,\n): ChartTooltipSide => {\n const pad = VIEWPORT_PADDING_PX;\n const reach = TOOLTIP_GAP_PX;\n const fits: Record<ChartTooltipSide, boolean> = {\n top: anchor.top - reach - height >= pad,\n bottom: anchor.top + reach + height <= window.innerHeight - pad,\n left: anchor.left - reach - width >= pad,\n right: anchor.left + reach + width <= window.innerWidth - pad,\n };\n // Flip only when the preferred side overflows and the opposite has room\n if (!fits[preferred] && fits[OPPOSITE_SIDE[preferred]]) {\n return OPPOSITE_SIDE[preferred];\n }\n return preferred;\n};\n\n/**\n * The design-system tooltip anchored at a chart position; drive it with\n * `useChartTooltip`.\n *\n * Renders the same visual as the ui `TooltipContent` (bubble + arrow) but\n * positions it directly from the anchor coordinates — Radix's popper\n * repositions asynchronously and mis-measures animated content, which made\n * tooltips drift on charts. Placement supports all four sides with\n * Radix-style collision flipping.\n */\nexport function ChartTooltip({ anchor, bubbleRef }: ChartTooltipProps) {\n const wrapperRef = useRef<HTMLDivElement>(null);\n const preferredSide = anchor?.side ?? \"top\";\n const [resolvedSide, setResolvedSide] = useState<ChartTooltipSide>(preferredSide);\n\n // Forward the wrapper node to both the internal measure ref and the\n // optional external ref (used by cursor-following charts to clamp it)\n const setBubbleNode = useCallback(\n (node: HTMLDivElement | null) => {\n wrapperRef.current = node;\n if (typeof bubbleRef === \"function\") bubbleRef(node);\n else if (bubbleRef) {\n (bubbleRef as { current: HTMLDivElement | null }).current = node;\n }\n },\n [bubbleRef],\n );\n\n // Measure before paint and flip to the opposite side if needed\n useLayoutEffect(() => {\n const node = wrapperRef.current;\n if (!anchor || !node) return;\n const next = resolveSide(\n preferredSide,\n anchor,\n node.offsetWidth,\n node.offsetHeight,\n );\n setResolvedSide((current) => (current === next ? current : next));\n }, [anchor, preferredSide]);\n\n if (!anchor) return null;\n const side = SIDE_CLASSES[resolvedSide];\n return createPortal(\n <div\n data-slot=\"chart-tooltip-anchor\"\n className=\"pointer-events-none fixed z-50\"\n style={{ left: anchor.left, top: anchor.top }}\n >\n {/* Positioning transforms live on this node; animations (which also\n drive `transform`) live on the bubble below so they can't clobber\n each other */}\n <div ref={setBubbleNode} className={cn(\"w-max\", side.wrapper)}>\n <div\n role=\"tooltip\"\n data-slot=\"tooltip-content\"\n data-side={resolvedSide}\n className={cn(\n \"relative w-fit max-w-xs rounded-md bg-foreground px-3 py-1.5 text-xs text-background\",\n anchor.closing\n ? \"animate-out fade-out zoom-out-95 fill-mode-forwards\"\n : \"animate-in fade-in-0 zoom-in-95\",\n )}\n >\n {anchor.lines.map((line, index) => (\n <div key={`${index}-${line}`}>{line}</div>\n ))}\n <span\n aria-hidden\n className={cn(\n \"absolute size-2.5 rotate-45 rounded-[2px] bg-foreground\",\n side.arrow,\n )}\n />\n </div>\n </div>\n </div>,\n document.body,\n );\n}\n\nexport interface UseChartTooltipOptions {\n /** Axis label used for the default x line (falls back to \"X\") */\n xLabel?: string;\n /** Axis label used for the default y line (falls back to \"Y\") */\n yLabel?: string;\n /** Override the default line builder entirely */\n getLines?: (points: ChartTooltipHoverPoint[]) => string[];\n /**\n * Track the cursor instead of anchoring to the hovered point's bounds, and\n * keep the tooltip clamped inside the viewport. Use for traces with large\n * hover targets (e.g. pie slices) where a fixed anchor feels disconnected.\n */\n followCursor?: boolean;\n /**\n * Override Plotly's hover hit radius (px). A larger radius makes big markers\n * (e.g. heatmap circles) hoverable across their whole face.\n */\n hoverDistance?: number;\n /**\n * Preferred side to place the tooltip on relative to the point. Auto-flips to\n * the opposite side when there isn't room (Radix-style). Defaults to \"top\".\n */\n side?: ChartTooltipSide;\n}\n\n/** Clamp an anchor point so a bubble of `width`×`height` stays on-screen */\nconst clampAnchor = (\n left: number,\n top: number,\n width: number,\n height: number,\n): { left: number; top: number } => {\n const halfWidth = width / 2;\n const clampedLeft = Math.min(\n Math.max(left, halfWidth + VIEWPORT_PADDING_PX),\n window.innerWidth - halfWidth - VIEWPORT_PADDING_PX,\n );\n // The bubble sits above the anchor; keep its top edge inside the viewport\n const clampedTop = Math.min(\n Math.max(top, height + 10 + VIEWPORT_PADDING_PX),\n window.innerHeight - VIEWPORT_PADDING_PX,\n );\n return { left: clampedLeft, top: clampedTop };\n};\n\n/**\n * Drives the design-system tooltip from Plotly hover events.\n *\n * ```tsx\n * const { bindTooltip, tooltipElement } = useChartTooltip({ xLabel, yLabel });\n * // after Plotly.newPlot(...): set trace hoverinfo to \"none\", then\n * bindTooltip(plotRef.current);\n * // anywhere in the chart markup:\n * {tooltipElement}\n * ```\n */\nexport function useChartTooltip(options: UseChartTooltipOptions = {}) {\n const [anchor, setAnchor] = useState<ChartTooltipAnchor | null>(null);\n const hideTimerRef = useRef<ReturnType<typeof setTimeout>>(undefined);\n const optionsRef = useRef(options);\n optionsRef.current = options;\n // Measured bubble node, used to clamp the cursor-following tooltip on-screen\n const bubbleRef = useRef<HTMLDivElement>(null);\n // Active lines while a cursor-following tooltip is shown; null when hidden\n const cursorLinesRef = useRef<string[] | null>(null);\n // Removes the mousemove listener registered by the previous bindTooltip call\n const detachMouseMoveRef = useRef<(() => void) | null>(null);\n\n const bindTooltip = useCallback((plotDiv: HTMLElement | null) => {\n if (!plotDiv) return;\n // The chart effect can re-run (size/theme/props changes) and call this\n // again on the same node; drop the prior mousemove listener so they don't\n // accumulate. (Plotly's own hover/unhover handlers are cleared by newPlot.)\n detachMouseMoveRef.current?.();\n detachMouseMoveRef.current = null;\n setAnchor(null);\n cursorLinesRef.current = null;\n\n // A larger hover radius makes the tooltip easier to acquire and keep\n void Plotly.relayout(plotDiv, {\n hoverdistance: optionsRef.current.hoverDistance ?? HOVER_DISTANCE_PX,\n });\n\n const emitter = plotDiv as unknown as ChartTooltipEmitter;\n\n // Place the cursor-following tooltip at the (clamped) cursor position\n const positionAtCursor = (lines: string[], clientX: number, clientY: number) => {\n const bubble = bubbleRef.current;\n const { left, top } = clampAnchor(\n clientX,\n clientY,\n bubble?.offsetWidth ?? 0,\n bubble?.offsetHeight ?? 0,\n );\n setAnchor({ left, top, lines, side: optionsRef.current.side });\n };\n\n emitter.on(\"plotly_hover\", (eventData) => {\n const points = eventData.points ?? [];\n const { getLines, xLabel, yLabel, followCursor } = optionsRef.current;\n const lines = getLines\n ? getLines(points)\n : chartTooltipLines(points, { xLabel, yLabel });\n if (lines.length === 0) return;\n\n clearTimeout(hideTimerRef.current);\n\n const mouse = eventData.event;\n if (followCursor) {\n cursorLinesRef.current = lines;\n positionAtCursor(lines, mouse?.clientX ?? 0, mouse?.clientY ?? 0);\n return;\n }\n\n // Anchor to the hovered point's bounds (in plot-div pixels) when\n // Plotly provides them; fall back to the mouse position. The anchor\n // is position:fixed, so viewport coordinates are used directly.\n const point = points[0];\n const bbox = point?.bbox;\n let left = 0;\n let top = 0;\n if (bbox) {\n const rect = plotDiv.getBoundingClientRect();\n left = rect.left + (bbox.x0 + bbox.x1) / 2;\n // Bars report a zero-height bbox that sits below their visual top;\n // anchor to the bar's true top via the axis projection instead.\n const yaxis = point?.yaxis;\n if (\n bbox.y0 === bbox.y1 &&\n typeof point?.y === \"number\" &&\n typeof yaxis?.l2p === \"function\" &&\n typeof yaxis._offset === \"number\"\n ) {\n top = rect.top + yaxis._offset + yaxis.l2p(point.y);\n } else {\n top = rect.top + Math.min(bbox.y0, bbox.y1);\n }\n } else if (mouse) {\n left = mouse.clientX;\n top = mouse.clientY;\n }\n setAnchor({ left, top, lines, side: optionsRef.current.side });\n });\n\n // While following the cursor, keep the tooltip glued to the pointer even\n // when Plotly does not re-fire hover within the same point (e.g. a slice)\n const handleMouseMove = (event: MouseEvent) => {\n if (!optionsRef.current.followCursor) return;\n const lines = cursorLinesRef.current;\n if (!lines) return;\n positionAtCursor(lines, event.clientX, event.clientY);\n };\n plotDiv.addEventListener(\"mousemove\", handleMouseMove);\n detachMouseMoveRef.current = () =>\n plotDiv.removeEventListener(\"mousemove\", handleMouseMove);\n\n emitter.on(\"plotly_unhover\", () => {\n clearTimeout(hideTimerRef.current);\n cursorLinesRef.current = null;\n // After the grace period, play the exit animation, then unmount\n hideTimerRef.current = setTimeout(() => {\n setAnchor((previous) =>\n previous ? { ...previous, closing: true } : previous,\n );\n hideTimerRef.current = setTimeout(() => setAnchor(null), EXIT_ANIMATION_MS);\n }, HIDE_GRACE_MS);\n });\n }, []);\n\n return {\n bindTooltip,\n tooltipElement: <ChartTooltip anchor={anchor} bubbleRef={bubbleRef} />,\n };\n}\n"],"names":["HOVER_DISTANCE_PX","HIDE_GRACE_MS","EXIT_ANIMATION_MS","VIEWPORT_PADDING_PX","TOOLTIP_GAP_PX","OPPOSITE_SIDE","SIDE_CLASSES","resolveSide","preferred","anchor","width","height","pad","reach","fits","ChartTooltip","bubbleRef","wrapperRef","useRef","preferredSide","resolvedSide","setResolvedSide","useState","setBubbleNode","useCallback","node","useLayoutEffect","next","current","side","createPortal","jsx","cn","jsxs","line","index","clampAnchor","left","top","halfWidth","clampedLeft","clampedTop","useChartTooltip","options","setAnchor","hideTimerRef","optionsRef","cursorLinesRef","detachMouseMoveRef","plotDiv","Plotly","emitter","positionAtCursor","lines","clientX","clientY","bubble","eventData","points","getLines","xLabel","yLabel","followCursor","chartTooltipLines","mouse","point","bbox","rect","yaxis","handleMouseMove","event","previous"],"mappings":"wPAkBMA,EAAoB,GAEpBC,EAAgB,IAEhBC,EAAoB,IAgBpBC,EAAsB,EAEtBC,EAAiB,GAGjBC,EAA4D,CAChE,IAAK,SACL,OAAQ,MACR,KAAM,QACN,MAAO,MACT,EAOMC,EAA6E,CACjF,IAAK,CACH,QAAS,kDACT,MAAO,qCAAA,EAET,OAAQ,CACN,QAAS,sCACT,MAAO,kCAAA,EAET,KAAM,CACJ,QAAS,kDACT,MAAO,mCAAA,EAET,MAAO,CACL,QAAS,sCACT,MAAO,kCAAA,CAEX,EAsBMC,EAAc,CAClBC,EACAC,EACAC,EACAC,IACqB,CACrB,MAAMC,EAAMT,EACNU,EAAQT,EACRU,EAA0C,CAC9C,IAAKL,EAAO,IAAMI,EAAQF,GAAUC,EACpC,OAAQH,EAAO,IAAMI,EAAQF,GAAU,OAAO,YAAcC,EAC5D,KAAMH,EAAO,KAAOI,EAAQH,GAASE,EACrC,MAAOH,EAAO,KAAOI,EAAQH,GAAS,OAAO,WAAaE,CAAA,EAG5D,MAAI,CAACE,EAAKN,CAAS,GAAKM,EAAKT,EAAcG,CAAS,CAAC,EAC5CH,EAAcG,CAAS,EAEzBA,C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