@tetrascience-npm/tetrascience-react-ui 0.6.0 → 0.7.0-beta.101.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.
- package/README.md +55 -0
- package/dist/components/ai/chain-of-thought.cjs +1 -1
- package/dist/components/ai/chain-of-thought.cjs.map +1 -1
- package/dist/components/ai/chain-of-thought.js +5 -5
- package/dist/components/ai/chain-of-thought.js.map +1 -1
- package/dist/components/ai/conversation.cjs +2 -2
- package/dist/components/ai/conversation.cjs.map +1 -1
- package/dist/components/ai/conversation.js +2 -2
- package/dist/components/ai/conversation.js.map +1 -1
- package/dist/components/ai/queue.cjs +1 -1
- package/dist/components/ai/queue.cjs.map +1 -1
- package/dist/components/ai/queue.js +9 -9
- package/dist/components/ai/queue.js.map +1 -1
- package/dist/components/charts/AreaGraph/AreaGraph.cjs +1 -1
- package/dist/components/charts/AreaGraph/AreaGraph.cjs.map +1 -1
- package/dist/components/charts/AreaGraph/AreaGraph.js +165 -103
- package/dist/components/charts/AreaGraph/AreaGraph.js.map +1 -1
- package/dist/components/charts/BarGraph/BarGraph.cjs +1 -1
- package/dist/components/charts/BarGraph/BarGraph.cjs.map +1 -1
- package/dist/components/charts/BarGraph/BarGraph.js +135 -90
- package/dist/components/charts/BarGraph/BarGraph.js.map +1 -1
- package/dist/components/charts/Boxplot/Boxplot.cjs +1 -1
- package/dist/components/charts/Boxplot/Boxplot.cjs.map +1 -1
- package/dist/components/charts/Boxplot/Boxplot.js +130 -92
- package/dist/components/charts/Boxplot/Boxplot.js.map +1 -1
- package/dist/components/charts/ChartTooltip/ChartTooltip.cjs +2 -0
- package/dist/components/charts/ChartTooltip/ChartTooltip.cjs.map +1 -0
- package/dist/components/charts/ChartTooltip/ChartTooltip.js +163 -0
- package/dist/components/charts/ChartTooltip/ChartTooltip.js.map +1 -0
- package/dist/components/charts/ChartTooltip/lines.cjs +2 -0
- package/dist/components/charts/ChartTooltip/lines.cjs.map +1 -0
- package/dist/components/charts/ChartTooltip/lines.js +29 -0
- package/dist/components/charts/ChartTooltip/lines.js.map +1 -0
- package/dist/components/charts/Chromatogram/Chromatogram.cjs +1 -1
- package/dist/components/charts/Chromatogram/Chromatogram.cjs.map +1 -1
- package/dist/components/charts/Chromatogram/Chromatogram.js +75 -61
- package/dist/components/charts/Chromatogram/Chromatogram.js.map +1 -1
- package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs +1 -1
- package/dist/components/charts/ChromatogramChart/ChromatogramChart.cjs.map +1 -1
- package/dist/components/charts/ChromatogramChart/ChromatogramChart.js +116 -108
- package/dist/components/charts/ChromatogramChart/ChromatogramChart.js.map +1 -1
- package/dist/components/charts/ChromatogramChart/annotations.cjs +1 -1
- package/dist/components/charts/ChromatogramChart/annotations.cjs.map +1 -1
- package/dist/components/charts/ChromatogramChart/annotations.js +32 -32
- package/dist/components/charts/ChromatogramChart/annotations.js.map +1 -1
- package/dist/components/charts/ChromatogramChart/boundaryMarkers.cjs +1 -1
- package/dist/components/charts/ChromatogramChart/boundaryMarkers.cjs.map +1 -1
- package/dist/components/charts/ChromatogramChart/boundaryMarkers.js +6 -6
- package/dist/components/charts/ChromatogramChart/boundaryMarkers.js.map +1 -1
- package/dist/components/charts/ChromatogramChart/constants.cjs +1 -1
- package/dist/components/charts/ChromatogramChart/constants.cjs.map +1 -1
- package/dist/components/charts/ChromatogramChart/constants.js +11 -5
- package/dist/components/charts/ChromatogramChart/constants.js.map +1 -1
- package/dist/components/charts/ChromatogramChart/dataProcessing.cjs +1 -1
- package/dist/components/charts/ChromatogramChart/dataProcessing.cjs.map +1 -1
- package/dist/components/charts/ChromatogramChart/dataProcessing.js +38 -49
- package/dist/components/charts/ChromatogramChart/dataProcessing.js.map +1 -1
- package/dist/components/charts/DotPlot/DotPlot.cjs +1 -1
- package/dist/components/charts/DotPlot/DotPlot.cjs.map +1 -1
- package/dist/components/charts/DotPlot/DotPlot.js +112 -88
- package/dist/components/charts/DotPlot/DotPlot.js.map +1 -1
- package/dist/components/charts/Histogram/Histogram.cjs +1 -1
- package/dist/components/charts/Histogram/Histogram.cjs.map +1 -1
- package/dist/components/charts/Histogram/Histogram.js +132 -115
- package/dist/components/charts/Histogram/Histogram.js.map +1 -1
- package/dist/components/charts/LineGraph/LineGraph.cjs +1 -1
- package/dist/components/charts/LineGraph/LineGraph.cjs.map +1 -1
- package/dist/components/charts/LineGraph/LineGraph.js +151 -111
- package/dist/components/charts/LineGraph/LineGraph.js.map +1 -1
- package/dist/components/charts/PieChart/PieChart.cjs +1 -1
- package/dist/components/charts/PieChart/PieChart.cjs.map +1 -1
- package/dist/components/charts/PieChart/PieChart.js +81 -70
- package/dist/components/charts/PieChart/PieChart.js.map +1 -1
- package/dist/components/charts/PlateMap/PlateMap.cjs +1 -1
- package/dist/components/charts/PlateMap/PlateMap.cjs.map +1 -1
- package/dist/components/charts/PlateMap/PlateMap.js +271 -256
- package/dist/components/charts/PlateMap/PlateMap.js.map +1 -1
- package/dist/components/charts/PlateMap/constants.cjs +1 -1
- package/dist/components/charts/PlateMap/constants.cjs.map +1 -1
- package/dist/components/charts/PlateMap/constants.js +20 -29
- package/dist/components/charts/PlateMap/constants.js.map +1 -1
- package/dist/components/charts/ScatterGraph/ScatterGraph.cjs +1 -1
- package/dist/components/charts/ScatterGraph/ScatterGraph.cjs.map +1 -1
- package/dist/components/charts/ScatterGraph/ScatterGraph.js +154 -106
- package/dist/components/charts/ScatterGraph/ScatterGraph.js.map +1 -1
- package/dist/components/composed/DataAppShell/DataAppShell.cjs +1 -1
- package/dist/components/composed/DataAppShell/DataAppShell.cjs.map +1 -1
- package/dist/components/composed/DataAppShell/DataAppShell.js +118 -111
- package/dist/components/composed/DataAppShell/DataAppShell.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapGrid.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapGrid.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapGrid.js +1 -1
- package/dist/components/composed/PlateMapEditor/PlateMapGrid.js.map +1 -1
- package/dist/components/composed/PlateMapEditor/WellLegend.cjs +1 -1
- package/dist/components/composed/PlateMapEditor/WellLegend.cjs.map +1 -1
- package/dist/components/composed/PlateMapEditor/WellLegend.js +8 -8
- package/dist/components/composed/PlateMapEditor/WellLegend.js.map +1 -1
- package/dist/components/composed/RichListItem/RichListItem.cjs +1 -1
- package/dist/components/composed/RichListItem/RichListItem.cjs.map +1 -1
- package/dist/components/composed/RichListItem/RichListItem.js +16 -16
- package/dist/components/composed/RichListItem/RichListItem.js.map +1 -1
- package/dist/components/ui/accordion.cjs +1 -1
- package/dist/components/ui/accordion.cjs.map +1 -1
- package/dist/components/ui/accordion.js +1 -1
- package/dist/components/ui/accordion.js.map +1 -1
- package/dist/components/ui/badge.cjs +1 -1
- package/dist/components/ui/badge.cjs.map +1 -1
- package/dist/components/ui/badge.js +8 -8
- package/dist/components/ui/badge.js.map +1 -1
- package/dist/components/ui/button.cjs +1 -1
- package/dist/components/ui/button.cjs.map +1 -1
- package/dist/components/ui/button.js +11 -11
- package/dist/components/ui/button.js.map +1 -1
- package/dist/components/ui/combobox.cjs +1 -1
- package/dist/components/ui/combobox.cjs.map +1 -1
- package/dist/components/ui/combobox.js +12 -12
- package/dist/components/ui/combobox.js.map +1 -1
- package/dist/components/ui/input-group.cjs +1 -1
- package/dist/components/ui/input-group.cjs.map +1 -1
- package/dist/components/ui/input-group.js +19 -19
- package/dist/components/ui/input-group.js.map +1 -1
- package/dist/components/ui/item.cjs +1 -1
- package/dist/components/ui/item.cjs.map +1 -1
- package/dist/components/ui/item.js +1 -1
- package/dist/components/ui/item.js.map +1 -1
- package/dist/components/ui/menubar.cjs +1 -1
- package/dist/components/ui/menubar.cjs.map +1 -1
- package/dist/components/ui/menubar.js +1 -1
- package/dist/components/ui/menubar.js.map +1 -1
- package/dist/components/ui/navigation-menu.cjs +1 -1
- package/dist/components/ui/navigation-menu.cjs.map +1 -1
- package/dist/components/ui/navigation-menu.js +54 -54
- package/dist/components/ui/navigation-menu.js.map +1 -1
- package/dist/components/ui/resizable.cjs +1 -1
- package/dist/components/ui/resizable.cjs.map +1 -1
- package/dist/components/ui/resizable.js +27 -15
- package/dist/components/ui/resizable.js.map +1 -1
- package/dist/components/ui/select.cjs +1 -1
- package/dist/components/ui/select.cjs.map +1 -1
- package/dist/components/ui/select.js +1 -1
- package/dist/components/ui/select.js.map +1 -1
- package/dist/components/ui/slider.cjs +1 -1
- package/dist/components/ui/slider.cjs.map +1 -1
- package/dist/components/ui/slider.js +9 -9
- package/dist/components/ui/slider.js.map +1 -1
- package/dist/components/ui/table.cjs +1 -1
- package/dist/components/ui/table.cjs.map +1 -1
- package/dist/components/ui/table.js +13 -13
- package/dist/components/ui/table.js.map +1 -1
- package/dist/components/ui/tabs.cjs +1 -1
- package/dist/components/ui/tabs.cjs.map +1 -1
- package/dist/components/ui/tabs.js +7 -7
- package/dist/components/ui/tabs.js.map +1 -1
- package/dist/components/ui/toggle.cjs +1 -1
- package/dist/components/ui/toggle.cjs.map +1 -1
- package/dist/components/ui/toggle.js +12 -12
- package/dist/components/ui/toggle.js.map +1 -1
- package/dist/hooks/use-element-size.cjs +2 -0
- package/dist/hooks/use-element-size.cjs.map +1 -0
- package/dist/hooks/use-element-size.js +21 -0
- package/dist/hooks/use-element-size.js.map +1 -0
- package/dist/hooks/use-plotly-theme.cjs +1 -1
- package/dist/hooks/use-plotly-theme.cjs.map +1 -1
- package/dist/hooks/use-plotly-theme.js +4 -2
- package/dist/hooks/use-plotly-theme.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.css +1 -1
- package/dist/index.d.ts +254 -77
- package/dist/index.js +587 -581
- package/dist/index.js.map +1 -1
- package/dist/index.tailwind.css +1 -1
- package/dist/utils/colors.cjs +1 -1
- package/dist/utils/colors.cjs.map +1 -1
- package/dist/utils/colors.js +38 -93
- package/dist/utils/colors.js.map +1 -1
- package/package.json +18 -12
|
@@ -1,158 +1,176 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import
|
|
3
|
-
import { useRef as
|
|
1
|
+
import { jsxs as h, jsx as y } from "react/jsx-runtime";
|
|
2
|
+
import De from "plotly.js-dist";
|
|
3
|
+
import { useRef as Pe, useState as lt, useMemo as i, useEffect as rt } from "react";
|
|
4
4
|
/* empty css */
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
5
|
+
import { useChartTooltip as nt } from "../ChartTooltip/ChartTooltip.js";
|
|
6
|
+
import { PLATE_CONFIGS as st, DEFAULT_COLOR_SCALE as ct, DEFAULT_CATEGORY_COLORS as it, PLATEMAP_CONSTANTS as v, COLORS as se, NAMED_COLORSCALES as pt } from "./constants.js";
|
|
7
|
+
import { PLATE_FORMAT_96 as dt, PLATE_FORMAT_CUSTOM as ut } from "./types.js";
|
|
8
|
+
import { PLATE_FORMAT_1536 as Vt, PLATE_FORMAT_384 as Bt } from "./types.js";
|
|
9
|
+
import { calculateMarkerSize as mt, hasMultiValueWells as ft, extractLayers as gt, wellDataToGrid as ht, generateRowLabels as yt, generateColumnLabels as xt, calculateValueRange as St, buildWellHoverText as _t, parseRegionWells as vt, flattenGridData as At, buildColorbarConfig as Lt, calculateAxisDomain as Mt, buildPlotMargins as wt, calculateTitleX as Et } from "./utils.js";
|
|
10
|
+
import { Button as Tt } from "../../ui/button.js";
|
|
11
|
+
import { usePlotlyTheme as Ct } from "../../../hooks/use-plotly-theme.js";
|
|
12
|
+
const Gt = ({
|
|
13
|
+
data: f,
|
|
14
|
+
layerConfigs: ce,
|
|
15
|
+
initialLayerId: ke,
|
|
16
|
+
onLayerChange: $e,
|
|
17
|
+
plateFormat: ie = dt,
|
|
18
|
+
rows: Ge,
|
|
19
|
+
columns: Fe,
|
|
20
|
+
visualizationMode: Ue = "heatmap",
|
|
21
|
+
categoryColors: pe,
|
|
22
|
+
regions: A,
|
|
23
|
+
title: E,
|
|
24
|
+
xTitle: de,
|
|
25
|
+
yTitle: b,
|
|
26
|
+
xLabels: ue,
|
|
27
|
+
yLabels: me,
|
|
28
|
+
colorScale: Ve = ct,
|
|
29
|
+
valueMin: Be,
|
|
30
|
+
valueMax: Ze,
|
|
31
|
+
emptyWellColor: L = se.emptyWell,
|
|
32
|
+
showColorBar: fe = !0,
|
|
33
|
+
showLegend: He = !0,
|
|
34
|
+
legendConfig: g,
|
|
35
|
+
width: T = 800,
|
|
36
|
+
height: O = 500,
|
|
37
|
+
precision: J = 0,
|
|
38
|
+
markerShape: G = "circle",
|
|
39
|
+
onWellClick: ge
|
|
39
40
|
}) => {
|
|
40
|
-
const
|
|
41
|
-
|
|
42
|
-
const [
|
|
43
|
-
let
|
|
44
|
-
if (
|
|
45
|
-
|
|
41
|
+
const he = Pe(null), x = Ct(), K = Pe(ge);
|
|
42
|
+
K.current = ge;
|
|
43
|
+
const [Q, je] = lt(ke);
|
|
44
|
+
let r, n;
|
|
45
|
+
if (ie === ut)
|
|
46
|
+
r = Ge ?? 8, n = Fe ?? 12;
|
|
46
47
|
else {
|
|
47
|
-
const e =
|
|
48
|
-
|
|
48
|
+
const e = st[ie];
|
|
49
|
+
r = e.rows, n = e.columns;
|
|
49
50
|
}
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
51
|
+
const Y = i(
|
|
52
|
+
() => mt(T, O, r, n, G, !!E, !!b),
|
|
53
|
+
[T, O, r, n, G, E, b]
|
|
54
|
+
), { bindTooltip: ye, tooltipElement: qe } = nt({
|
|
55
|
+
hoverDistance: Math.ceil(Y / 2)
|
|
56
|
+
}), p = i(() => {
|
|
57
|
+
if (Array.isArray(f) && f.length > 0 && "wellId" in f[0]) {
|
|
58
|
+
const e = f;
|
|
59
|
+
if (ft(e))
|
|
60
|
+
return gt(e, ce);
|
|
55
61
|
}
|
|
56
62
|
return null;
|
|
57
|
-
}, [
|
|
58
|
-
() => ({ ...
|
|
59
|
-
[
|
|
60
|
-
),
|
|
63
|
+
}, [f, ce]), d = i(() => !p || p.length === 0 ? null : Q ? p.find((e) => e.id === Q) ?? p[0] : p[0], [p, Q]), R = d?.visualizationMode ?? Ue, C = d?.colorScale ?? Ve, We = d?.valueMin ?? Be, Xe = d?.valueMax ?? Ze, F = d?.valueUnit ? ` ${d.valueUnit}` : "", U = i(
|
|
64
|
+
() => ({ ...it, ...pe, ...d?.categoryColors }),
|
|
65
|
+
[pe, d?.categoryColors]
|
|
66
|
+
), xe = d?.id, { grid: S, categoriesGrid: ee, allValuesMap: V, tooltipDataMap: B } = i(() => {
|
|
61
67
|
let e, t = Array.from(
|
|
62
|
-
{ length:
|
|
63
|
-
() => Array(
|
|
68
|
+
{ length: r },
|
|
69
|
+
() => Array(n).fill(null)
|
|
64
70
|
), o = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map();
|
|
65
|
-
if (Array.isArray(
|
|
66
|
-
const a =
|
|
71
|
+
if (Array.isArray(f) && f.length > 0) {
|
|
72
|
+
const a = ht(f, r, n, xe);
|
|
67
73
|
e = a.grid, t = a.categories, o = a.allValues, l = a.tooltipData;
|
|
68
74
|
} else
|
|
69
75
|
e = Array.from(
|
|
70
|
-
{ length:
|
|
71
|
-
() => Array.from({ length:
|
|
76
|
+
{ length: r },
|
|
77
|
+
() => Array.from({ length: n }, () => Math.random() * v.MAX_RANDOM_VALUE)
|
|
72
78
|
);
|
|
73
79
|
return { grid: e, categoriesGrid: t, allValuesMap: o, tooltipDataMap: l };
|
|
74
|
-
}, [
|
|
75
|
-
|
|
80
|
+
}, [f, r, n, xe]), _ = i(
|
|
81
|
+
() => me ?? yt(r),
|
|
82
|
+
[me, r]
|
|
83
|
+
), M = i(
|
|
84
|
+
() => ue ?? xt(n),
|
|
85
|
+
[ue, n]
|
|
86
|
+
), Se = St(S), z = We ?? Se.min, I = Xe ?? Se.max, D = S.some((e) => e.includes(null)), N = z - (I - z) * v.SENTINEL_RATIO - 1, _e = i(
|
|
87
|
+
() => D ? S.map((e) => e.map((t) => t === null ? N : t)) : S,
|
|
88
|
+
[D, S, N]
|
|
89
|
+
), ve = i(() => {
|
|
90
|
+
if (!D) return C;
|
|
76
91
|
let e;
|
|
77
|
-
if (typeof
|
|
78
|
-
const a =
|
|
92
|
+
if (typeof C == "string") {
|
|
93
|
+
const a = pt[C];
|
|
79
94
|
if (a)
|
|
80
95
|
e = a;
|
|
81
96
|
else
|
|
82
|
-
return
|
|
97
|
+
return C;
|
|
83
98
|
} else
|
|
84
|
-
e =
|
|
85
|
-
const t =
|
|
86
|
-
[0,
|
|
87
|
-
[o *
|
|
99
|
+
e = C;
|
|
100
|
+
const t = I - N, o = (z - N) / t, l = [
|
|
101
|
+
[0, L],
|
|
102
|
+
[o * v.COLOR_SCALE_THRESHOLD, L]
|
|
88
103
|
// Small band for empty wells
|
|
89
104
|
];
|
|
90
105
|
for (const [a, c] of e) {
|
|
91
|
-
const
|
|
92
|
-
l.push([
|
|
106
|
+
const u = o + a * (1 - o);
|
|
107
|
+
l.push([u, c]);
|
|
93
108
|
}
|
|
94
109
|
return l;
|
|
95
|
-
}, [
|
|
110
|
+
}, [C, D, z, I, N, L]), Ae = D ? N : z, Le = i(() => {
|
|
96
111
|
const e = /* @__PURE__ */ new Map();
|
|
97
|
-
if (
|
|
98
|
-
for (const t of
|
|
112
|
+
if (p)
|
|
113
|
+
for (const t of p)
|
|
99
114
|
e.set(t.id, t);
|
|
100
115
|
return e;
|
|
101
|
-
}, [
|
|
102
|
-
(
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
116
|
+
}, [p]), Me = i(
|
|
117
|
+
() => S.map(
|
|
118
|
+
(e, t) => e.map((o, l) => {
|
|
119
|
+
const a = `${_[t]}${M[l]}`, c = String(a).toUpperCase();
|
|
120
|
+
return _t({
|
|
121
|
+
wellId: a,
|
|
122
|
+
value: o,
|
|
123
|
+
allValues: V.get(c),
|
|
124
|
+
tooltipExtra: B.get(c),
|
|
125
|
+
activeLayerId: d?.id,
|
|
126
|
+
layerConfigMap: Le,
|
|
127
|
+
precision: J,
|
|
128
|
+
valueUnit: F
|
|
129
|
+
});
|
|
130
|
+
})
|
|
131
|
+
),
|
|
132
|
+
[S, _, M, V, B, d?.id, Le, J, F]
|
|
133
|
+
), { categoricalGrid: te, categoricalColorScale: ae, uniqueTypes: oe, catMax: we } = i(() => {
|
|
134
|
+
if (R !== "categorical")
|
|
117
135
|
return { categoricalGrid: null, categoricalColorScale: null, uniqueTypes: [], catMax: 0 };
|
|
118
136
|
const e = /* @__PURE__ */ new Set();
|
|
119
137
|
let t = !1;
|
|
120
|
-
for (const
|
|
121
|
-
for (const
|
|
122
|
-
|
|
138
|
+
for (const s of ee)
|
|
139
|
+
for (const m of s)
|
|
140
|
+
m ? e.add(m) : t = !0;
|
|
123
141
|
t && e.add("empty");
|
|
124
142
|
const o = [...e].sort(), l = /* @__PURE__ */ new Map();
|
|
125
|
-
o.forEach((
|
|
126
|
-
const a =
|
|
127
|
-
(
|
|
128
|
-
), c = o.length,
|
|
143
|
+
o.forEach((s, m) => l.set(s, m));
|
|
144
|
+
const a = ee.map(
|
|
145
|
+
(s) => s.map((m) => m === null ? l.get("empty") ?? 0 : l.get(m) ?? l.get("empty") ?? 0)
|
|
146
|
+
), c = o.length, u = [];
|
|
129
147
|
if (c === 1) {
|
|
130
|
-
const
|
|
131
|
-
|
|
148
|
+
const s = U[o[0]] || L;
|
|
149
|
+
u.push([0, s]), u.push([1, s]);
|
|
132
150
|
} else
|
|
133
|
-
o.forEach((
|
|
134
|
-
const
|
|
135
|
-
|
|
151
|
+
o.forEach((s, m) => {
|
|
152
|
+
const q = U[s] || L, W = m / (c - 1), X = 0.5 / (c - 1), $ = Math.max(0, W - X), re = Math.min(1, W + X - v.COLOR_SCALE_EPSILON);
|
|
153
|
+
u.push([$, q]), u.push([re, q]);
|
|
136
154
|
});
|
|
137
|
-
return { categoricalGrid: a, categoricalColorScale:
|
|
138
|
-
}, [
|
|
139
|
-
if (!
|
|
155
|
+
return { categoricalGrid: a, categoricalColorScale: u, uniqueTypes: o, catMax: c - 1 };
|
|
156
|
+
}, [R, ee, U, L]), Ee = i(() => {
|
|
157
|
+
if (!A || A.length === 0)
|
|
140
158
|
return [];
|
|
141
159
|
const e = [];
|
|
142
|
-
for (const t of
|
|
143
|
-
const o =
|
|
160
|
+
for (const t of A) {
|
|
161
|
+
const o = vt(t.wells, _, M);
|
|
144
162
|
if (!o) continue;
|
|
145
|
-
const l = 0.49, a = o.minCol + 1 - l, c = o.maxCol + 1 + l,
|
|
163
|
+
const l = 0.49, a = o.minCol + 1 - l, c = o.maxCol + 1 + l, u = o.minRow - l, s = o.maxRow + l;
|
|
146
164
|
e.push({
|
|
147
165
|
type: "rect",
|
|
148
166
|
xref: "x",
|
|
149
167
|
yref: "y",
|
|
150
168
|
x0: a,
|
|
151
169
|
x1: c,
|
|
152
|
-
y0:
|
|
153
|
-
y1:
|
|
170
|
+
y0: u,
|
|
171
|
+
y1: s,
|
|
154
172
|
line: {
|
|
155
|
-
color: t.borderColor ||
|
|
173
|
+
color: t.borderColor || se.textDark,
|
|
156
174
|
width: t.borderWidth ?? 2
|
|
157
175
|
},
|
|
158
176
|
fillcolor: t.fillColor || "transparent",
|
|
@@ -160,76 +178,68 @@ const Dt = ({
|
|
|
160
178
|
});
|
|
161
179
|
}
|
|
162
180
|
return e;
|
|
163
|
-
}, [
|
|
164
|
-
|
|
165
|
-
const e =
|
|
181
|
+
}, [A, _, M]);
|
|
182
|
+
rt(() => {
|
|
183
|
+
const e = he.current;
|
|
166
184
|
if (!e) return;
|
|
167
|
-
const t =
|
|
185
|
+
const t = R === "categorical", o = t && te ? te : _e, l = t && ae ? ae : ve, a = t ? 0 : Ae, c = t ? we || 1 : I, u = t ? !1 : fe, { xData: s, yData: m, colorData: q, textData: W } = At(
|
|
168
186
|
o,
|
|
169
|
-
|
|
170
|
-
|
|
187
|
+
_,
|
|
188
|
+
Me,
|
|
189
|
+
r,
|
|
171
190
|
n,
|
|
172
|
-
s,
|
|
173
191
|
a
|
|
174
|
-
),
|
|
175
|
-
C,
|
|
176
|
-
P,
|
|
177
|
-
n,
|
|
178
|
-
s,
|
|
179
|
-
j,
|
|
180
|
-
!!T,
|
|
181
|
-
!!k
|
|
182
|
-
), oe = [
|
|
192
|
+
), X = [
|
|
183
193
|
{
|
|
184
|
-
x:
|
|
185
|
-
y:
|
|
194
|
+
x: s,
|
|
195
|
+
y: m,
|
|
186
196
|
mode: "markers",
|
|
187
197
|
type: "scatter",
|
|
188
198
|
marker: {
|
|
189
|
-
symbol:
|
|
190
|
-
size:
|
|
191
|
-
color:
|
|
199
|
+
symbol: G,
|
|
200
|
+
size: Y,
|
|
201
|
+
color: q,
|
|
192
202
|
colorscale: l,
|
|
193
203
|
cmin: a,
|
|
194
204
|
cmax: c,
|
|
195
|
-
showscale:
|
|
196
|
-
colorbar:
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
205
|
+
showscale: u,
|
|
206
|
+
colorbar: Lt(
|
|
207
|
+
g?.position ?? "right",
|
|
208
|
+
F,
|
|
209
|
+
g?.title
|
|
200
210
|
),
|
|
201
211
|
line: {
|
|
202
|
-
color:
|
|
212
|
+
color: x.gridColor,
|
|
203
213
|
width: 1
|
|
204
214
|
}
|
|
205
215
|
},
|
|
206
|
-
hoverinfo: "
|
|
207
|
-
text:
|
|
216
|
+
hoverinfo: "none",
|
|
217
|
+
text: W
|
|
208
218
|
}
|
|
209
|
-
],
|
|
219
|
+
], $ = g?.position ?? "right", re = {
|
|
210
220
|
autosize: !1,
|
|
211
221
|
// Prevent auto-sizing to maintain consistent layout
|
|
212
|
-
title:
|
|
213
|
-
text:
|
|
222
|
+
title: E ? {
|
|
223
|
+
text: E,
|
|
214
224
|
font: {
|
|
215
225
|
family: "Inter, sans-serif",
|
|
216
226
|
size: 20,
|
|
217
|
-
color:
|
|
227
|
+
color: x.textSecondary
|
|
218
228
|
},
|
|
219
|
-
x:
|
|
229
|
+
x: Et($),
|
|
220
230
|
xanchor: "center",
|
|
221
231
|
y: 0.98,
|
|
222
232
|
yanchor: "top"
|
|
223
233
|
} : void 0,
|
|
224
|
-
width:
|
|
225
|
-
height:
|
|
226
|
-
margin:
|
|
234
|
+
width: T,
|
|
235
|
+
height: O,
|
|
236
|
+
margin: wt($, !!E, !!b),
|
|
227
237
|
xaxis: {
|
|
228
238
|
title: {
|
|
229
|
-
text:
|
|
239
|
+
text: de || "",
|
|
230
240
|
font: {
|
|
231
241
|
size: 16,
|
|
232
|
-
color:
|
|
242
|
+
color: x.textSecondary,
|
|
233
243
|
family: "Inter, sans-serif"
|
|
234
244
|
},
|
|
235
245
|
standoff: 15
|
|
@@ -237,214 +247,219 @@ const Dt = ({
|
|
|
237
247
|
side: "top",
|
|
238
248
|
fixedrange: !0,
|
|
239
249
|
dtick: 1,
|
|
240
|
-
range: [0.5,
|
|
250
|
+
range: [0.5, n + 0.5],
|
|
241
251
|
// Explicit range to prevent auto-padding
|
|
242
252
|
automargin: !1,
|
|
243
253
|
// Prevent auto margin adjustment
|
|
244
254
|
tickmode: "array",
|
|
245
|
-
tickvals: Array.from({ length:
|
|
246
|
-
ticktext:
|
|
255
|
+
tickvals: Array.from({ length: n }, (ne, w) => w + 1),
|
|
256
|
+
ticktext: M.map(String),
|
|
247
257
|
tickangle: 0,
|
|
248
258
|
// Keep labels horizontal
|
|
249
|
-
tickfont: { size:
|
|
259
|
+
tickfont: { size: n > 24 ? 8 : v.FONT_SIZE_LARGE },
|
|
250
260
|
// Smaller font for high-density plates
|
|
251
261
|
// Adjust domain based on legend position to prevent colorbar overlap
|
|
252
|
-
domain:
|
|
262
|
+
domain: Mt($)
|
|
253
263
|
},
|
|
254
264
|
yaxis: {
|
|
255
265
|
title: {
|
|
256
|
-
text:
|
|
266
|
+
text: b || "",
|
|
257
267
|
font: {
|
|
258
268
|
size: 16,
|
|
259
|
-
color:
|
|
269
|
+
color: x.textSecondary,
|
|
260
270
|
family: "Inter, sans-serif"
|
|
261
271
|
},
|
|
262
272
|
standoff: 15
|
|
263
273
|
},
|
|
264
274
|
fixedrange: !0,
|
|
265
275
|
dtick: 1,
|
|
266
|
-
range: [
|
|
276
|
+
range: [r + v.LABEL_CENTER_OFFSET, v.LABEL_CENTER_OFFSET],
|
|
267
277
|
// Reversed range: high to low puts row A at top
|
|
268
278
|
automargin: !1,
|
|
269
279
|
// Prevent auto margin adjustment
|
|
270
280
|
tickmode: "array",
|
|
271
|
-
tickvals: Array.from({ length:
|
|
272
|
-
ticktext:
|
|
273
|
-
tickfont: { size:
|
|
281
|
+
tickvals: Array.from({ length: r }, (ne, w) => w),
|
|
282
|
+
ticktext: _.map(String),
|
|
283
|
+
tickfont: { size: r > 16 ? 8 : v.FONT_SIZE_LARGE }
|
|
274
284
|
// Smaller font for high-density plates
|
|
275
285
|
},
|
|
276
|
-
paper_bgcolor:
|
|
277
|
-
plot_bgcolor:
|
|
286
|
+
paper_bgcolor: x.paperBg,
|
|
287
|
+
plot_bgcolor: x.plotBg,
|
|
278
288
|
font: {
|
|
279
289
|
family: "Inter, sans-serif",
|
|
280
|
-
color:
|
|
290
|
+
color: x.textSecondary
|
|
281
291
|
},
|
|
282
|
-
shapes:
|
|
283
|
-
},
|
|
292
|
+
shapes: Ee
|
|
293
|
+
}, et = {
|
|
284
294
|
responsive: !0,
|
|
285
295
|
displayModeBar: !1,
|
|
286
296
|
displaylogo: !1
|
|
287
297
|
};
|
|
288
|
-
return
|
|
289
|
-
if (!
|
|
290
|
-
const
|
|
291
|
-
if (
|
|
292
|
-
const
|
|
293
|
-
if (
|
|
294
|
-
const
|
|
295
|
-
wellId:
|
|
296
|
-
values:
|
|
297
|
-
tooltipData:
|
|
298
|
+
return De.newPlot(e, X, re, et), ye(e), e.on("plotly_click", (ne) => {
|
|
299
|
+
if (!K.current) return;
|
|
300
|
+
const w = ne.points[0];
|
|
301
|
+
if (w) {
|
|
302
|
+
const Ne = _, be = M, Oe = Ne.indexOf(w.y), Re = be.indexOf(w.x);
|
|
303
|
+
if (Oe >= 0 && Re >= 0) {
|
|
304
|
+
const ze = `${Ne[Oe]}${be[Re]}`, Ie = String(ze).toUpperCase(), tt = V.get(Ie), at = B.get(Ie), ot = {
|
|
305
|
+
wellId: ze,
|
|
306
|
+
values: tt,
|
|
307
|
+
tooltipData: at
|
|
298
308
|
};
|
|
299
|
-
|
|
309
|
+
K.current?.(ot);
|
|
300
310
|
}
|
|
301
311
|
}
|
|
302
312
|
}), () => {
|
|
303
|
-
e &&
|
|
313
|
+
e && De.purge(e);
|
|
304
314
|
};
|
|
305
315
|
}, [
|
|
306
|
-
|
|
316
|
+
_e,
|
|
317
|
+
M,
|
|
318
|
+
_,
|
|
319
|
+
ve,
|
|
320
|
+
fe,
|
|
321
|
+
Ae,
|
|
322
|
+
I,
|
|
323
|
+
F,
|
|
307
324
|
E,
|
|
308
|
-
L,
|
|
309
|
-
ye,
|
|
310
|
-
pe,
|
|
311
|
-
xe,
|
|
312
|
-
O,
|
|
313
|
-
X,
|
|
314
|
-
T,
|
|
315
|
-
ie,
|
|
316
|
-
k,
|
|
317
|
-
C,
|
|
318
|
-
P,
|
|
319
|
-
Se,
|
|
320
325
|
de,
|
|
321
|
-
K,
|
|
322
|
-
J,
|
|
323
|
-
M,
|
|
324
326
|
b,
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
327
|
+
T,
|
|
328
|
+
O,
|
|
329
|
+
Me,
|
|
330
|
+
J,
|
|
331
|
+
B,
|
|
332
|
+
V,
|
|
333
|
+
S,
|
|
334
|
+
R,
|
|
335
|
+
te,
|
|
336
|
+
ae,
|
|
337
|
+
oe.length,
|
|
338
|
+
we,
|
|
339
|
+
Ee,
|
|
340
|
+
r,
|
|
330
341
|
n,
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
342
|
+
g,
|
|
343
|
+
G,
|
|
344
|
+
Y,
|
|
345
|
+
x,
|
|
346
|
+
ye
|
|
335
347
|
]);
|
|
336
|
-
const
|
|
337
|
-
const t =
|
|
338
|
-
return /* @__PURE__ */
|
|
339
|
-
|
|
348
|
+
const Je = () => !p || p.length <= 1 ? null : /* @__PURE__ */ y("div", { className: "platemap-layer-selector", children: p.map((e) => {
|
|
349
|
+
const t = d?.id === e.id;
|
|
350
|
+
return /* @__PURE__ */ y(
|
|
351
|
+
Tt,
|
|
340
352
|
{
|
|
341
353
|
variant: t ? "default" : "outline",
|
|
342
354
|
size: "sm",
|
|
343
355
|
onClick: () => {
|
|
344
|
-
|
|
356
|
+
je(e.id), $e?.(e.id);
|
|
345
357
|
},
|
|
346
358
|
children: e.name
|
|
347
359
|
},
|
|
348
360
|
e.id
|
|
349
361
|
);
|
|
350
|
-
}) }),
|
|
351
|
-
const e =
|
|
352
|
-
if (!
|
|
353
|
-
return
|
|
362
|
+
}) }), P = g?.position ?? "right", le = g?.fontSize ?? 12, Ke = g?.itemSpacing ?? 4, Z = g?.swatchSize ?? 16, Te = g?.title, Ce = 120, k = P === "top" || P === "bottom", Qe = () => {
|
|
363
|
+
const e = R === "categorical" && oe.length > 0, t = A && A.length > 0;
|
|
364
|
+
if (!He || !e && !t)
|
|
365
|
+
return k ? null : /* @__PURE__ */ y("div", { className: "platemap-legend-placeholder", style: { width: Ce } });
|
|
354
366
|
const o = ["platemap-legend"];
|
|
355
|
-
|
|
367
|
+
k ? o.push("platemap-legend--horizontal") : P === "left" ? o.push("platemap-legend--left") : P === "right" && o.push("platemap-legend--right");
|
|
356
368
|
const l = {
|
|
357
|
-
gap: `${
|
|
358
|
-
width:
|
|
369
|
+
gap: `${Ke}px`,
|
|
370
|
+
width: k ? void 0 : Ce
|
|
359
371
|
};
|
|
360
|
-
return /* @__PURE__ */
|
|
361
|
-
|
|
372
|
+
return /* @__PURE__ */ h("div", { className: o.join(" "), style: l, children: [
|
|
373
|
+
Te && /* @__PURE__ */ y(
|
|
362
374
|
"div",
|
|
363
375
|
{
|
|
364
|
-
className: `platemap-legend__title${
|
|
365
|
-
style: { fontSize: `${
|
|
366
|
-
children:
|
|
376
|
+
className: `platemap-legend__title${k ? " platemap-legend__title--horizontal" : ""}`,
|
|
377
|
+
style: { fontSize: `${le}px` },
|
|
378
|
+
children: Te
|
|
367
379
|
}
|
|
368
380
|
),
|
|
369
|
-
e &&
|
|
370
|
-
/* @__PURE__ */
|
|
381
|
+
e && oe.map((a) => /* @__PURE__ */ h("div", { className: "platemap-legend__item", children: [
|
|
382
|
+
/* @__PURE__ */ y(
|
|
371
383
|
"div",
|
|
372
384
|
{
|
|
373
385
|
className: "platemap-legend__swatch",
|
|
374
386
|
style: {
|
|
375
|
-
width: `${
|
|
376
|
-
height: `${
|
|
377
|
-
backgroundColor:
|
|
387
|
+
width: `${Z}px`,
|
|
388
|
+
height: `${Z}px`,
|
|
389
|
+
backgroundColor: U[a] || L
|
|
378
390
|
}
|
|
379
391
|
}
|
|
380
392
|
),
|
|
381
|
-
/* @__PURE__ */
|
|
393
|
+
/* @__PURE__ */ y(
|
|
382
394
|
"span",
|
|
383
395
|
{
|
|
384
396
|
className: "platemap-legend__label platemap-legend__label--capitalize",
|
|
385
|
-
style: { fontSize: `${
|
|
397
|
+
style: { fontSize: `${le}px` },
|
|
386
398
|
children: a
|
|
387
399
|
}
|
|
388
400
|
)
|
|
389
401
|
] }, a)),
|
|
390
|
-
t &&
|
|
391
|
-
/* @__PURE__ */
|
|
402
|
+
t && A.map((a) => /* @__PURE__ */ h("div", { className: "platemap-legend__item", children: [
|
|
403
|
+
/* @__PURE__ */ y(
|
|
392
404
|
"div",
|
|
393
405
|
{
|
|
394
406
|
className: "platemap-legend__swatch platemap-legend__swatch--region",
|
|
395
407
|
style: {
|
|
396
|
-
width: `${
|
|
397
|
-
height: `${
|
|
408
|
+
width: `${Z}px`,
|
|
409
|
+
height: `${Z}px`,
|
|
398
410
|
backgroundColor: a.fillColor || "transparent",
|
|
399
|
-
border: `${a.borderWidth || 2}px solid ${a.borderColor ||
|
|
411
|
+
border: `${a.borderWidth || 2}px solid ${a.borderColor || se.regionBorder}`
|
|
400
412
|
}
|
|
401
413
|
}
|
|
402
414
|
),
|
|
403
|
-
/* @__PURE__ */
|
|
415
|
+
/* @__PURE__ */ y(
|
|
404
416
|
"span",
|
|
405
417
|
{
|
|
406
418
|
className: "platemap-legend__label",
|
|
407
|
-
style: { fontSize: `${
|
|
419
|
+
style: { fontSize: `${le}px` },
|
|
408
420
|
children: a.name
|
|
409
421
|
}
|
|
410
422
|
)
|
|
411
423
|
] }, a.id))
|
|
412
424
|
] });
|
|
413
|
-
},
|
|
414
|
-
|
|
425
|
+
}, H = /* @__PURE__ */ h("div", { className: "relative", children: [
|
|
426
|
+
/* @__PURE__ */ y("div", { ref: he, className: "platemap-plot", style: { width: T, height: O } }),
|
|
427
|
+
qe
|
|
428
|
+
] }), j = Qe(), Ye = () => {
|
|
429
|
+
switch (P) {
|
|
415
430
|
case "left":
|
|
416
|
-
return /* @__PURE__ */
|
|
417
|
-
|
|
418
|
-
|
|
431
|
+
return /* @__PURE__ */ h("div", { className: "platemap-plot-wrapper platemap-plot-wrapper--vertical", children: [
|
|
432
|
+
j,
|
|
433
|
+
H
|
|
419
434
|
] });
|
|
420
435
|
case "top":
|
|
421
|
-
return /* @__PURE__ */
|
|
422
|
-
|
|
423
|
-
|
|
436
|
+
return /* @__PURE__ */ h("div", { className: "platemap-plot-wrapper platemap-plot-wrapper--horizontal", children: [
|
|
437
|
+
j,
|
|
438
|
+
H
|
|
424
439
|
] });
|
|
425
440
|
case "bottom":
|
|
426
|
-
return /* @__PURE__ */
|
|
427
|
-
|
|
428
|
-
|
|
441
|
+
return /* @__PURE__ */ h("div", { className: "platemap-plot-wrapper platemap-plot-wrapper--horizontal", children: [
|
|
442
|
+
H,
|
|
443
|
+
j
|
|
429
444
|
] });
|
|
430
445
|
default:
|
|
431
|
-
return /* @__PURE__ */
|
|
432
|
-
|
|
433
|
-
|
|
446
|
+
return /* @__PURE__ */ h("div", { className: "platemap-plot-wrapper platemap-plot-wrapper--vertical", children: [
|
|
447
|
+
H,
|
|
448
|
+
j
|
|
434
449
|
] });
|
|
435
450
|
}
|
|
436
451
|
};
|
|
437
|
-
return /* @__PURE__ */
|
|
438
|
-
|
|
452
|
+
return /* @__PURE__ */ h("div", { className: "platemap-container", style: { width: k ? void 0 : T }, children: [
|
|
453
|
+
Je(),
|
|
439
454
|
Ye()
|
|
440
455
|
] });
|
|
441
456
|
};
|
|
442
457
|
export {
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
458
|
+
it as DEFAULT_CATEGORY_COLORS,
|
|
459
|
+
Vt as PLATE_FORMAT_1536,
|
|
460
|
+
Bt as PLATE_FORMAT_384,
|
|
461
|
+
dt as PLATE_FORMAT_96,
|
|
462
|
+
ut as PLATE_FORMAT_CUSTOM,
|
|
463
|
+
Gt as PlateMap
|
|
449
464
|
};
|
|
450
465
|
//# sourceMappingURL=PlateMap.js.map
|