@tetrascience-npm/tetrascience-react-ui 0.6.0-beta.83.1 → 0.6.0-beta.84.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 (63) hide show
  1. package/dist/components/charts/AreaGraph/AreaGraph.cjs +1 -1
  2. package/dist/components/charts/AreaGraph/AreaGraph.cjs.map +1 -1
  3. package/dist/components/charts/AreaGraph/AreaGraph.js +112 -82
  4. package/dist/components/charts/AreaGraph/AreaGraph.js.map +1 -1
  5. package/dist/components/charts/BarGraph/BarGraph.cjs +1 -1
  6. package/dist/components/charts/BarGraph/BarGraph.cjs.map +1 -1
  7. package/dist/components/charts/BarGraph/BarGraph.js +53 -48
  8. package/dist/components/charts/BarGraph/BarGraph.js.map +1 -1
  9. package/dist/components/charts/Boxplot/Boxplot.cjs +1 -1
  10. package/dist/components/charts/Boxplot/Boxplot.cjs.map +1 -1
  11. package/dist/components/charts/Boxplot/Boxplot.js +65 -60
  12. package/dist/components/charts/Boxplot/Boxplot.js.map +1 -1
  13. package/dist/components/charts/ChartTooltip/ChartTooltip.cjs +2 -0
  14. package/dist/components/charts/ChartTooltip/ChartTooltip.cjs.map +1 -0
  15. package/dist/components/charts/ChartTooltip/ChartTooltip.js +163 -0
  16. package/dist/components/charts/ChartTooltip/ChartTooltip.js.map +1 -0
  17. package/dist/components/charts/ChartTooltip/lines.cjs +2 -0
  18. package/dist/components/charts/ChartTooltip/lines.cjs.map +1 -0
  19. package/dist/components/charts/ChartTooltip/lines.js +29 -0
  20. package/dist/components/charts/ChartTooltip/lines.js.map +1 -0
  21. package/dist/components/charts/Chromatogram/Chromatogram.cjs +1 -1
  22. package/dist/components/charts/Chromatogram/Chromatogram.cjs.map +1 -1
  23. package/dist/components/charts/Chromatogram/Chromatogram.js +75 -66
  24. package/dist/components/charts/Chromatogram/Chromatogram.js.map +1 -1
  25. package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs +1 -1
  26. package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs.map +1 -1
  27. package/dist/components/charts/ChromatogramChart/ChromatogramChart.js +107 -99
  28. package/dist/components/charts/ChromatogramChart/ChromatogramChart.js.map +1 -1
  29. package/dist/components/charts/ChromatogramChart/dataProcessing.cjs +1 -1
  30. package/dist/components/charts/ChromatogramChart/dataProcessing.cjs.map +1 -1
  31. package/dist/components/charts/ChromatogramChart/dataProcessing.js +38 -49
  32. package/dist/components/charts/ChromatogramChart/dataProcessing.js.map +1 -1
  33. package/dist/components/charts/DotPlot/DotPlot.cjs +1 -1
  34. package/dist/components/charts/DotPlot/DotPlot.cjs.map +1 -1
  35. package/dist/components/charts/DotPlot/DotPlot.js +52 -48
  36. package/dist/components/charts/DotPlot/DotPlot.js.map +1 -1
  37. package/dist/components/charts/Histogram/Histogram.cjs +1 -1
  38. package/dist/components/charts/Histogram/Histogram.cjs.map +1 -1
  39. package/dist/components/charts/Histogram/Histogram.js +96 -92
  40. package/dist/components/charts/Histogram/Histogram.js.map +1 -1
  41. package/dist/components/charts/LineGraph/LineGraph.cjs +1 -1
  42. package/dist/components/charts/LineGraph/LineGraph.cjs.map +1 -1
  43. package/dist/components/charts/LineGraph/LineGraph.js +44 -39
  44. package/dist/components/charts/LineGraph/LineGraph.js.map +1 -1
  45. package/dist/components/charts/PieChart/PieChart.cjs +1 -1
  46. package/dist/components/charts/PieChart/PieChart.cjs.map +1 -1
  47. package/dist/components/charts/PieChart/PieChart.js +58 -54
  48. package/dist/components/charts/PieChart/PieChart.js.map +1 -1
  49. package/dist/components/charts/PlateMap/PlateMap.cjs +1 -1
  50. package/dist/components/charts/PlateMap/PlateMap.cjs.map +1 -1
  51. package/dist/components/charts/PlateMap/PlateMap.js +271 -256
  52. package/dist/components/charts/PlateMap/PlateMap.js.map +1 -1
  53. package/dist/components/charts/ScatterGraph/ScatterGraph.cjs +1 -1
  54. package/dist/components/charts/ScatterGraph/ScatterGraph.cjs.map +1 -1
  55. package/dist/components/charts/ScatterGraph/ScatterGraph.js +112 -89
  56. package/dist/components/charts/ScatterGraph/ScatterGraph.js.map +1 -1
  57. package/dist/index.cjs +1 -1
  58. package/dist/index.css +1 -1
  59. package/dist/index.d.ts +130 -0
  60. package/dist/index.js +585 -580
  61. package/dist/index.js.map +1 -1
  62. package/dist/index.tailwind.css +1 -1
  63. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -48,6 +48,7 @@ import * as React_2 from 'react';
48
48
  import { ReactElement } from 'react';
49
49
  import { ReactNode } from 'react';
50
50
  import { ReactPortal } from 'react';
51
+ import { Ref } from 'react';
51
52
  import { RefObject } from 'react';
52
53
  import * as ResizablePrimitive from 'react-resizable-panels';
53
54
  import { ScrollArea as ScrollArea_2 } from 'radix-ui';
@@ -578,6 +579,94 @@ export declare const CHART_SEQUENTIAL: {
578
579
  readonly purple: string[];
579
580
  };
580
581
 
582
+ /**
583
+ * The design-system tooltip anchored at a chart position; drive it with
584
+ * `useChartTooltip`.
585
+ *
586
+ * Renders the same visual as the ui `TooltipContent` (bubble + arrow) but
587
+ * positions it directly from the anchor coordinates — Radix's popper
588
+ * repositions asynchronously and mis-measures animated content, which made
589
+ * tooltips drift on charts. Placement supports all four sides with
590
+ * Radix-style collision flipping.
591
+ */
592
+ export declare function ChartTooltip({ anchor, bubbleRef }: ChartTooltipProps): ReactPortal | null;
593
+
594
+ export declare interface ChartTooltipAnchor {
595
+ left: number;
596
+ top: number;
597
+ lines: string[];
598
+ /** Preferred placement side; auto-flips to the opposite when it won't fit */
599
+ side?: ChartTooltipSide;
600
+ /** Plays the exit animation before the tooltip unmounts */
601
+ closing?: boolean;
602
+ }
603
+
604
+ /**
605
+ * Minimal structural view of a Plotly hover point — covers cartesian, pie,
606
+ * and heatmap traces without depending on Plotly's loose event typings.
607
+ */
608
+ export declare interface ChartTooltipHoverPoint {
609
+ x?: number | string;
610
+ y?: number | string;
611
+ z?: number;
612
+ /** Pie slice label */
613
+ label?: string;
614
+ /** Pie slice value */
615
+ value?: number;
616
+ /** Pie slice raw value (Plotly's `v` alias) */
617
+ v?: number;
618
+ /** Pie slice percentage (0–100) */
619
+ percent?: number;
620
+ /** Per-point hover text (e.g. PlateMap wells), lines separated by `<br>` */
621
+ text?: string;
622
+ pointIndex?: number;
623
+ data?: {
624
+ name?: string;
625
+ };
626
+ /** Per-point custom data attached to the trace */
627
+ customdata?: unknown;
628
+ /** Hovered point bounds in plot-div pixels (provided by Plotly) */
629
+ bbox?: {
630
+ x0: number;
631
+ x1: number;
632
+ y0: number;
633
+ y1: number;
634
+ };
635
+ /**
636
+ * Plotly axis objects (internal) used to project a data value to a plot-div
637
+ * pixel. Bars report a `bbox` that sits below their visual top, so we anchor
638
+ * to `_offset + l2p(value)` instead.
639
+ */
640
+ yaxis?: {
641
+ _offset?: number;
642
+ l2p?: (value: number) => number;
643
+ };
644
+ xaxis?: {
645
+ _offset?: number;
646
+ l2p?: (value: number) => number;
647
+ };
648
+ }
649
+
650
+ /**
651
+ * Build default tooltip lines from Plotly hover points. Handles pie slices,
652
+ * text-carrying traces (e.g. PlateMap wells), single cartesian points, and
653
+ * unified multi-trace hovers.
654
+ */
655
+ export declare function chartTooltipLines(points: ChartTooltipHoverPoint[], labels?: {
656
+ xLabel?: string;
657
+ yLabel?: string;
658
+ }): string[];
659
+
660
+ export declare interface ChartTooltipProps {
661
+ /** Anchor position (viewport coordinates) and content lines */
662
+ anchor: ChartTooltipAnchor | null;
663
+ /** Ref to the bubble node, used by cursor-following charts to clamp it on-screen */
664
+ bubbleRef?: Ref<HTMLDivElement>;
665
+ }
666
+
667
+ /** Which edge of the point the tooltip is placed against (matches Radix). */
668
+ export declare type ChartTooltipSide = "top" | "bottom" | "left" | "right";
669
+
581
670
  export declare const Chat: ({ initialMessages, models, defaultModel, suggestions, onSend, className, }: ChatProps) => JSX.Element;
582
671
 
583
672
  export declare interface ChatMessage {
@@ -3863,6 +3952,47 @@ export declare function useCarousel(): CarouselContextProps;
3863
3952
 
3864
3953
  declare type UseCarouselParameters = Parameters<typeof default_3>;
3865
3954
 
3955
+ /**
3956
+ * Drives the design-system tooltip from Plotly hover events.
3957
+ *
3958
+ * ```tsx
3959
+ * const { bindTooltip, tooltipElement } = useChartTooltip({ xLabel, yLabel });
3960
+ * // after Plotly.newPlot(...): set trace hoverinfo to "none", then
3961
+ * bindTooltip(plotRef.current);
3962
+ * // anywhere in the chart markup:
3963
+ * {tooltipElement}
3964
+ * ```
3965
+ */
3966
+ export declare function useChartTooltip(options?: UseChartTooltipOptions): {
3967
+ bindTooltip: (plotDiv: HTMLElement | null) => void;
3968
+ tooltipElement: JSX.Element;
3969
+ };
3970
+
3971
+ export declare interface UseChartTooltipOptions {
3972
+ /** Axis label used for the default x line (falls back to "X") */
3973
+ xLabel?: string;
3974
+ /** Axis label used for the default y line (falls back to "Y") */
3975
+ yLabel?: string;
3976
+ /** Override the default line builder entirely */
3977
+ getLines?: (points: ChartTooltipHoverPoint[]) => string[];
3978
+ /**
3979
+ * Track the cursor instead of anchoring to the hovered point's bounds, and
3980
+ * keep the tooltip clamped inside the viewport. Use for traces with large
3981
+ * hover targets (e.g. pie slices) where a fixed anchor feels disconnected.
3982
+ */
3983
+ followCursor?: boolean;
3984
+ /**
3985
+ * Override Plotly's hover hit radius (px). A larger radius makes big markers
3986
+ * (e.g. heatmap circles) hoverable across their whole face.
3987
+ */
3988
+ hoverDistance?: number;
3989
+ /**
3990
+ * Preferred side to place the tooltip on relative to the point. Auto-flips to
3991
+ * the opposite side when there isn't room (Radix-style). Defaults to "top".
3992
+ */
3993
+ side?: ChartTooltipSide;
3994
+ }
3995
+
3866
3996
  export declare function useComboboxAnchor(): React_2.RefObject<HTMLDivElement | null>;
3867
3997
 
3868
3998
  export declare function useDataTable<TData = unknown>(): TableContextValue<TData>;