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