@tetrascience-npm/tetrascience-react-ui 0.6.0-beta.82.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 (87) 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 +132 -98
  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 +63 -57
  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 +83 -74
  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 -61
  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 +116 -108
  28. package/dist/components/charts/ChromatogramChart/ChromatogramChart.js.map +1 -1
  29. package/dist/components/charts/ChromatogramChart/annotations.cjs +1 -1
  30. package/dist/components/charts/ChromatogramChart/annotations.cjs.map +1 -1
  31. package/dist/components/charts/ChromatogramChart/annotations.js +32 -32
  32. package/dist/components/charts/ChromatogramChart/annotations.js.map +1 -1
  33. package/dist/components/charts/ChromatogramChart/boundaryMarkers.cjs +1 -1
  34. package/dist/components/charts/ChromatogramChart/boundaryMarkers.cjs.map +1 -1
  35. package/dist/components/charts/ChromatogramChart/boundaryMarkers.js +6 -6
  36. package/dist/components/charts/ChromatogramChart/boundaryMarkers.js.map +1 -1
  37. package/dist/components/charts/ChromatogramChart/constants.cjs +1 -1
  38. package/dist/components/charts/ChromatogramChart/constants.cjs.map +1 -1
  39. package/dist/components/charts/ChromatogramChart/constants.js +11 -5
  40. package/dist/components/charts/ChromatogramChart/constants.js.map +1 -1
  41. package/dist/components/charts/ChromatogramChart/dataProcessing.cjs +1 -1
  42. package/dist/components/charts/ChromatogramChart/dataProcessing.cjs.map +1 -1
  43. package/dist/components/charts/ChromatogramChart/dataProcessing.js +38 -49
  44. package/dist/components/charts/ChromatogramChart/dataProcessing.js.map +1 -1
  45. package/dist/components/charts/DotPlot/DotPlot.cjs +1 -1
  46. package/dist/components/charts/DotPlot/DotPlot.cjs.map +1 -1
  47. package/dist/components/charts/DotPlot/DotPlot.js +57 -63
  48. package/dist/components/charts/DotPlot/DotPlot.js.map +1 -1
  49. package/dist/components/charts/Histogram/Histogram.cjs +1 -1
  50. package/dist/components/charts/Histogram/Histogram.cjs.map +1 -1
  51. package/dist/components/charts/Histogram/Histogram.js +98 -104
  52. package/dist/components/charts/Histogram/Histogram.js.map +1 -1
  53. package/dist/components/charts/LineGraph/LineGraph.cjs +1 -1
  54. package/dist/components/charts/LineGraph/LineGraph.cjs.map +1 -1
  55. package/dist/components/charts/LineGraph/LineGraph.js +97 -88
  56. package/dist/components/charts/LineGraph/LineGraph.js.map +1 -1
  57. package/dist/components/charts/PieChart/PieChart.cjs +1 -1
  58. package/dist/components/charts/PieChart/PieChart.cjs.map +1 -1
  59. package/dist/components/charts/PieChart/PieChart.js +65 -68
  60. package/dist/components/charts/PieChart/PieChart.js.map +1 -1
  61. package/dist/components/charts/PlateMap/PlateMap.cjs +1 -1
  62. package/dist/components/charts/PlateMap/PlateMap.cjs.map +1 -1
  63. package/dist/components/charts/PlateMap/PlateMap.js +271 -256
  64. package/dist/components/charts/PlateMap/PlateMap.js.map +1 -1
  65. package/dist/components/charts/PlateMap/constants.cjs +1 -1
  66. package/dist/components/charts/PlateMap/constants.cjs.map +1 -1
  67. package/dist/components/charts/PlateMap/constants.js +20 -29
  68. package/dist/components/charts/PlateMap/constants.js.map +1 -1
  69. package/dist/components/charts/ScatterGraph/ScatterGraph.cjs +1 -1
  70. package/dist/components/charts/ScatterGraph/ScatterGraph.cjs.map +1 -1
  71. package/dist/components/charts/ScatterGraph/ScatterGraph.js +113 -89
  72. package/dist/components/charts/ScatterGraph/ScatterGraph.js.map +1 -1
  73. package/dist/hooks/use-plotly-theme.cjs +1 -1
  74. package/dist/hooks/use-plotly-theme.cjs.map +1 -1
  75. package/dist/hooks/use-plotly-theme.js +4 -2
  76. package/dist/hooks/use-plotly-theme.js.map +1 -1
  77. package/dist/index.cjs +1 -1
  78. package/dist/index.css +1 -1
  79. package/dist/index.d.ts +156 -76
  80. package/dist/index.js +587 -581
  81. package/dist/index.js.map +1 -1
  82. package/dist/index.tailwind.css +1 -1
  83. package/dist/utils/colors.cjs +1 -1
  84. package/dist/utils/colors.cjs.map +1 -1
  85. package/dist/utils/colors.js +38 -93
  86. package/dist/utils/colors.js.map +1 -1
  87. 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';
@@ -126,7 +127,8 @@ export declare interface AreaDataSeries {
126
127
  x: number[];
127
128
  y: number[];
128
129
  name: string;
129
- color: string;
130
+ /** Optional color override (auto-assigned from CHART_COLORS if not provided) */
131
+ color?: string;
130
132
  fill?: "tozeroy" | "tonexty" | "toself";
131
133
  }
132
134
 
@@ -292,7 +294,8 @@ export declare interface BarDataSeries {
292
294
  x: number[];
293
295
  y: number[];
294
296
  name: string;
295
- color: string;
297
+ /** Optional color override (auto-assigned from CHART_COLORS if not provided) */
298
+ color?: string;
296
299
  error_y?: {
297
300
  type: "data";
298
301
  array: number[];
@@ -337,7 +340,8 @@ declare type BoundaryMarkerType = "none" | "triangle" | "diamond";
337
340
  export declare interface BoxDataSeries {
338
341
  y: number[];
339
342
  name: string;
340
- color: string;
343
+ /** Optional color override (auto-assigned from CHART_COLORS if not provided) */
344
+ color?: string;
341
345
  x?: string[] | number[];
342
346
  boxpoints?: "all" | "outliers" | "suspectedoutliers" | false;
343
347
  jitter?: number;
@@ -575,6 +579,94 @@ export declare const CHART_SEQUENTIAL: {
575
579
  readonly purple: string[];
576
580
  };
577
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
+
578
670
  export declare const Chat: ({ initialMessages, models, defaultModel, suggestions, onSend, className, }: ChatProps) => JSX.Element;
579
671
 
580
672
  export declare interface ChatMessage {
@@ -786,75 +878,6 @@ export declare function CollapsibleContent({ ...props }: React.ComponentProps<ty
786
878
 
787
879
  export declare function CollapsibleTrigger({ ...props }: React.ComponentProps<typeof Collapsible_2.CollapsibleTrigger>): JSX.Element;
788
880
 
789
- /**
790
- * Centralized color tokens that map to CSS variables
791
- * This provides TypeScript support while leveraging CSS custom properties
792
- */
793
- export declare const COLORS: {
794
- readonly BLACK_50: string;
795
- readonly BLACK_100: string;
796
- readonly BLACK_200: string;
797
- readonly BLACK_300: string;
798
- readonly BLACK_400: string;
799
- readonly BLACK_500: string;
800
- readonly BLACK_600: string;
801
- readonly BLACK_700: string;
802
- readonly BLACK_800: string;
803
- readonly BLACK_900: string;
804
- readonly BLACK: string;
805
- readonly BLACK_OPACITY_20: "rgba(26, 26, 26, 0.2)";
806
- readonly WHITE_50: string;
807
- readonly WHITE_100: string;
808
- readonly WHITE_200: string;
809
- readonly WHITE_300: string;
810
- readonly WHITE_400: string;
811
- readonly WHITE_500: string;
812
- readonly WHITE_600: string;
813
- readonly WHITE_700: string;
814
- readonly WHITE_800: string;
815
- readonly WHITE_900: string;
816
- readonly WHITE: string;
817
- readonly BLUE_50: string;
818
- readonly BLUE_100: string;
819
- readonly BLUE_200: string;
820
- readonly BLUE_300: string;
821
- readonly BLUE_400: string;
822
- readonly BLUE_500: string;
823
- readonly BLUE_600: string;
824
- readonly BLUE_700: string;
825
- readonly BLUE_800: string;
826
- readonly BLUE_900: string;
827
- readonly BLUE: string;
828
- readonly GREY_50: string;
829
- readonly GREY_100: string;
830
- readonly GREY_200: string;
831
- readonly GREY_300: string;
832
- readonly GREY_400: string;
833
- readonly GREY_500: string;
834
- readonly GREY_600: string;
835
- readonly GREY_700: string;
836
- readonly GREY_800: string;
837
- readonly GREY_900: string;
838
- readonly GREY: string;
839
- readonly ORANGE: string;
840
- readonly RED: string;
841
- readonly GREEN: string;
842
- readonly YELLOW: string;
843
- readonly PURPLE: string;
844
- readonly GREEN_BG: string;
845
- readonly GREEN_SUCCESS: string;
846
- readonly ORANGE_BG: string;
847
- readonly ORANGE_CAUTION: string;
848
- readonly RED_BG: string;
849
- readonly RED_ERROR: string;
850
- readonly GRAPH_SECONDARY_BROWN: string;
851
- readonly GRAPH_SECONDARY_PINK: string;
852
- readonly GRAPH_SECONDARY_TEAL: string;
853
- readonly GRAPH_SECONDARY_DARK_BLUE: string;
854
- readonly GRAPH_SECONDARY_BLACK: string;
855
- readonly GRAPH_SECONDARY_GREY: string;
856
- };
857
-
858
881
  /**
859
882
  * Color scale definition for the heatmap visualization mode.
860
883
  *
@@ -876,8 +899,6 @@ export declare const COLORS: {
876
899
  */
877
900
  export declare type ColorScale = string | Array<[number, string]>;
878
901
 
879
- export declare type ColorToken = keyof typeof COLORS;
880
-
881
902
  export declare const Combobox: typeof Combobox_2.Root;
882
903
 
883
904
  export declare function ComboboxChip({ className, children, showRemove, ...props }: Combobox_2.Chip.Props & {
@@ -1798,7 +1819,8 @@ export declare interface LineDataSeries {
1798
1819
  x: number[];
1799
1820
  y: number[];
1800
1821
  name: string;
1801
- color: string;
1822
+ /** Optional color override (auto-assigned from CHART_COLORS if not provided) */
1823
+ color?: string;
1802
1824
  symbol?: MarkerSymbol;
1803
1825
  error_y?: {
1804
1826
  type: "data";
@@ -3205,7 +3227,8 @@ export declare interface ScatterDataSeries {
3205
3227
  x: number[];
3206
3228
  y: number[];
3207
3229
  name: string;
3208
- color: string;
3230
+ /** Optional color override (auto-assigned from CHART_COLORS if not provided) */
3231
+ color?: string;
3209
3232
  }
3210
3233
 
3211
3234
  export declare const ScatterGraph: default_2.FC<ScatterGraphProps>;
@@ -3256,6 +3279,16 @@ export declare function SelectValue({ ...props }: React_2.ComponentProps<typeof
3256
3279
 
3257
3280
  export declare function Separator({ className, orientation, decorative, ...props }: React_2.ComponentProps<typeof Separator_2.Root>): JSX.Element;
3258
3281
 
3282
+ /**
3283
+ * Resolve the color for a data series: use the explicit color when one is
3284
+ * provided, otherwise cycle through the {@link CHART_COLORS} palette by series
3285
+ * index (wrapping around when there are more series than palette slots).
3286
+ *
3287
+ * @param index - Zero-based series index
3288
+ * @param explicit - Caller-provided color override, if any
3289
+ */
3290
+ export declare const seriesColor: (index: number, explicit?: string | null) => string;
3291
+
3259
3292
  export declare function Sheet({ ...props }: React_2.ComponentProps<typeof Dialog_2.Root>): JSX.Element;
3260
3293
 
3261
3294
  export declare function SheetClose({ ...props }: React_2.ComponentProps<typeof Dialog_2.Close>): JSX.Element;
@@ -3898,6 +3931,12 @@ declare type ToolUIPartApproval = {
3898
3931
  reason?: string;
3899
3932
  } | undefined;
3900
3933
 
3934
+ /**
3935
+ * Convert a color ramp (e.g. `CHART_SEQUENTIAL.blue`, `CHART_DIVERGING.blueOrange`)
3936
+ * into Plotly's colorscale format: evenly spaced [position, color] stops.
3937
+ */
3938
+ export declare const toPlotlyColorscale: (ramp: readonly string[]) => Array<[number, string]>;
3939
+
3901
3940
  export declare function triagePlateMapCsvByBarcode(text: string, options?: PlateMapCsvTriageOptions): PlateMapCsvTriage;
3902
3941
 
3903
3942
  export declare function triagePlateMapCsvFile(file: File, options?: PlateMapCsvTriageOptions): Promise<PlateMapCsvTriage | undefined>;
@@ -3913,6 +3952,47 @@ export declare function useCarousel(): CarouselContextProps;
3913
3952
 
3914
3953
  declare type UseCarouselParameters = Parameters<typeof default_3>;
3915
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
+
3916
3996
  export declare function useComboboxAnchor(): React_2.RefObject<HTMLDivElement | null>;
3917
3997
 
3918
3998
  export declare function useDataTable<TData = unknown>(): TableContextValue<TData>;