@tetrascience-npm/tetrascience-react-ui 1.0.0-beta.157.1 → 1.0.0-beta.158.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 (68) hide show
  1. package/README.md +113 -0
  2. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.cjs +1 -1
  3. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.cjs.map +1 -1
  4. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.d.ts +5 -1
  5. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.js +32 -30
  6. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.js.map +1 -1
  7. package/dist/components/composed/PlateMapEditor/PlateMapEditor.cjs +1 -1
  8. package/dist/components/composed/PlateMapEditor/PlateMapEditor.cjs.map +1 -1
  9. package/dist/components/composed/PlateMapEditor/PlateMapEditor.d.ts +269 -13
  10. package/dist/components/composed/PlateMapEditor/PlateMapEditor.js +392 -310
  11. package/dist/components/composed/PlateMapEditor/PlateMapEditor.js.map +1 -1
  12. package/dist/components/composed/PlateMapEditor/PlateMapForm.cjs +1 -1
  13. package/dist/components/composed/PlateMapEditor/PlateMapForm.cjs.map +1 -1
  14. package/dist/components/composed/PlateMapEditor/PlateMapForm.d.ts +5 -1
  15. package/dist/components/composed/PlateMapEditor/PlateMapForm.js +19 -15
  16. package/dist/components/composed/PlateMapEditor/PlateMapForm.js.map +1 -1
  17. package/dist/components/composed/PlateMapEditor/PlateMapGrid.cjs +1 -1
  18. package/dist/components/composed/PlateMapEditor/PlateMapGrid.cjs.map +1 -1
  19. package/dist/components/composed/PlateMapEditor/PlateMapGrid.d.ts +12 -1
  20. package/dist/components/composed/PlateMapEditor/PlateMapGrid.js +69 -63
  21. package/dist/components/composed/PlateMapEditor/PlateMapGrid.js.map +1 -1
  22. package/dist/components/composed/PlateMapEditor/PlateMapManifest.cjs +1 -1
  23. package/dist/components/composed/PlateMapEditor/PlateMapManifest.cjs.map +1 -1
  24. package/dist/components/composed/PlateMapEditor/PlateMapManifest.d.ts +13 -4
  25. package/dist/components/composed/PlateMapEditor/PlateMapManifest.js +38 -29
  26. package/dist/components/composed/PlateMapEditor/PlateMapManifest.js.map +1 -1
  27. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.cjs +1 -1
  28. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.cjs.map +1 -1
  29. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.d.ts +6 -1
  30. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.js +490 -275
  31. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.js.map +1 -1
  32. package/dist/components/composed/PlateMapEditor/WellLegend.cjs +1 -1
  33. package/dist/components/composed/PlateMapEditor/WellLegend.cjs.map +1 -1
  34. package/dist/components/composed/PlateMapEditor/WellLegend.d.ts +8 -2
  35. package/dist/components/composed/PlateMapEditor/WellLegend.js +8 -7
  36. package/dist/components/composed/PlateMapEditor/WellLegend.js.map +1 -1
  37. package/dist/components/composed/PlateMapEditor/WellManifestTable.cjs +1 -1
  38. package/dist/components/composed/PlateMapEditor/WellManifestTable.cjs.map +1 -1
  39. package/dist/components/composed/PlateMapEditor/WellManifestTable.d.ts +6 -2
  40. package/dist/components/composed/PlateMapEditor/WellManifestTable.js +288 -256
  41. package/dist/components/composed/PlateMapEditor/WellManifestTable.js.map +1 -1
  42. package/dist/components/composed/PlateMapEditor/WellMetadataForm.cjs +1 -1
  43. package/dist/components/composed/PlateMapEditor/WellMetadataForm.cjs.map +1 -1
  44. package/dist/components/composed/PlateMapEditor/WellMetadataForm.d.ts +5 -1
  45. package/dist/components/composed/PlateMapEditor/WellMetadataForm.js +61 -66
  46. package/dist/components/composed/PlateMapEditor/WellMetadataForm.js.map +1 -1
  47. package/dist/components/composed/PlateMapEditor/WellQuickPaint.cjs +2 -0
  48. package/dist/components/composed/PlateMapEditor/WellQuickPaint.cjs.map +1 -0
  49. package/dist/components/composed/PlateMapEditor/WellQuickPaint.d.ts +23 -0
  50. package/dist/components/composed/PlateMapEditor/WellQuickPaint.js +75 -0
  51. package/dist/components/composed/PlateMapEditor/WellQuickPaint.js.map +1 -0
  52. package/dist/components/composed/PlateMapEditor/index.d.ts +6 -2
  53. package/dist/components/composed/PlateMapEditor/types.d.ts +65 -0
  54. package/dist/components/composed/PlateMapEditor/usePlateMapEditorState.cjs +2 -0
  55. package/dist/components/composed/PlateMapEditor/usePlateMapEditorState.cjs.map +1 -0
  56. package/dist/components/composed/PlateMapEditor/usePlateMapEditorState.d.ts +109 -0
  57. package/dist/components/composed/PlateMapEditor/usePlateMapEditorState.js +246 -0
  58. package/dist/components/composed/PlateMapEditor/usePlateMapEditorState.js.map +1 -0
  59. package/dist/composed/PlateMapEditor.cjs +1 -1
  60. package/dist/composed/PlateMapEditor.js +48 -42
  61. package/dist/composed/PlateMapEditor.js.map +1 -1
  62. package/dist/index.cjs +1 -1
  63. package/dist/index.css +1 -1
  64. package/dist/index.js +701 -695
  65. package/dist/index.js.map +1 -1
  66. package/dist/index.scoped.css +1 -1
  67. package/dist/index.tailwind.css +1 -1
  68. package/package.json +1 -1
@@ -1,244 +1,273 @@
1
- import { jsxs as i, jsx as t } from "react/jsx-runtime";
2
- import { Layers as _e, Check as ee, ChevronRight as ze, ChevronDown as Me, ArrowDownToLine as Te } from "lucide-react";
3
- import * as h from "react";
4
- import { ManifestFilterPopover as Ae } from "./ManifestFilterPopover.js";
5
- import { Badge as ne } from "../../../ui/badge.js";
6
- import { Button as F } from "../../../ui/button.js";
7
- import { Checkbox as te } from "../../../ui/checkbox.js";
8
- import { useComboboxAnchor as Fe, Combobox as Pe, ComboboxChips as Re, ComboboxValue as Ie, ComboboxChip as De, ComboboxChipsInput as Ge, ComboboxContent as Le, ComboboxEmpty as Be, ComboboxList as Ve, ComboboxItem as We } from "../../../ui/combobox.js";
9
- import { applyFilterCondition as $e } from "../../ui/data-table/data-table.js";
10
- import { Input as He } from "../../../ui/input.js";
11
- import { Select as B, SelectTrigger as V, SelectValue as W, SelectContent as $, SelectItem as P } from "../../../ui/select.js";
12
- import { Switch as je } from "../../../ui/switch.js";
13
- import { Table as Ze, TableHeader as Ue, TableRow as R, TableHead as H, TableBody as Ke, TableCell as M } from "../../../ui/table.js";
14
- import { TooltipProvider as Oe, Tooltip as Ye, TooltipTrigger as qe, TooltipContent as Je } from "../../../ui/tooltip.js";
15
- import { cn as I } from "../../../lib/utils.js";
16
- function Qe({
17
- ariaLabel: d,
18
- value: o,
19
- options: u,
20
- placeholder: c,
21
- onChange: p
1
+ import { jsxs as c, jsx as r } from "react/jsx-runtime";
2
+ import { Layers as _e, Check as ne, ChevronRight as Me, ChevronDown as Te, ArrowDownToLine as ze } from "lucide-react";
3
+ import * as p from "react";
4
+ import { ManifestFilterPopover as Re } from "./ManifestFilterPopover.js";
5
+ import { Badge as te } from "../../../ui/badge.js";
6
+ import { Button as z } from "../../../ui/button.js";
7
+ import { Checkbox as le } from "../../../ui/checkbox.js";
8
+ import { useComboboxAnchor as Ge, Combobox as Le, ComboboxChips as Ie, ComboboxValue as Be, ComboboxChip as De, ComboboxChipsInput as Ve, ComboboxContent as We, ComboboxEmpty as $e, ComboboxList as je, ComboboxItem as He } from "../../../ui/combobox.js";
9
+ import { applyFilterCondition as Ue } from "../../ui/data-table/data-table.js";
10
+ import { Input as Ze } from "../../../ui/input.js";
11
+ import { Select as V, SelectTrigger as W, SelectValue as $, SelectContent as j, SelectItem as R } from "../../../ui/select.js";
12
+ import { Switch as Oe } from "../../../ui/switch.js";
13
+ import { Table as Ke, TableHeader as Ye, TableRow as G, TableHead as H, TableBody as qe, TableCell as _ } from "../../../ui/table.js";
14
+ import { TooltipProvider as Je, Tooltip as Qe, TooltipTrigger as Xe, TooltipContent as er } from "../../../ui/tooltip.js";
15
+ import { cn as L } from "../../../lib/utils.js";
16
+ function rr({
17
+ ariaLabel: s,
18
+ value: i,
19
+ options: d,
20
+ placeholder: u,
21
+ onChange: g
22
22
  }) {
23
- const b = Fe(), g = h.useMemo(() => {
24
- const m = /* @__PURE__ */ new Map();
25
- return u.forEach((x) => m.set(x.value, x.label)), m;
26
- }, [u]);
27
- return /* @__PURE__ */ i(Pe, { multiple: !0, items: u.map((m) => m.value), value: o, onValueChange: p, children: [
28
- /* @__PURE__ */ i(Re, { ref: b, className: I("min-h-7 w-full py-0.5", j), children: [
29
- /* @__PURE__ */ t(Ie, { children: (m) => m.map((x) => /* @__PURE__ */ t(De, { children: g.get(x) ?? x }, x)) }),
30
- /* @__PURE__ */ t(Ge, { "aria-label": d, placeholder: c ?? "Select…" })
23
+ const x = Ge(), b = p.useMemo(() => {
24
+ const h = /* @__PURE__ */ new Map();
25
+ return d.forEach((w) => h.set(w.value, w.label)), h;
26
+ }, [d]);
27
+ return /* @__PURE__ */ c(Le, { multiple: !0, items: d.map((h) => h.value), value: i, onValueChange: g, children: [
28
+ /* @__PURE__ */ c(Ie, { ref: x, className: L("min-h-7 w-full py-0.5", U), children: [
29
+ /* @__PURE__ */ r(Be, { children: (h) => h.map((w) => /* @__PURE__ */ r(De, { children: b.get(w) ?? w }, w)) }),
30
+ /* @__PURE__ */ r(Ve, { "aria-label": s, placeholder: u ?? "Select…" })
31
31
  ] }),
32
- /* @__PURE__ */ i(Le, { anchor: b, children: [
33
- /* @__PURE__ */ t(Be, { children: "No options." }),
34
- /* @__PURE__ */ t(Ve, { "aria-label": d, children: (m) => /* @__PURE__ */ t(We, { value: m, children: g.get(m) ?? m }, m) })
32
+ /* @__PURE__ */ c(We, { anchor: x, children: [
33
+ /* @__PURE__ */ r($e, { children: "No options." }),
34
+ /* @__PURE__ */ r(je, { "aria-label": s, children: (h) => /* @__PURE__ */ r(He, { value: h, children: b.get(h) ?? h }, h) })
35
35
  ] })
36
36
  ] });
37
37
  }
38
- const j = "border-transparent shadow-none hover:border-input/40", le = 25, Xe = 50, en = 100, nn = le, tn = [le, Xe, en];
39
- function re(d) {
40
- return d != null && d !== "";
38
+ const U = "border-transparent shadow-none hover:border-input/40", oe = 25, nr = 50, tr = 100, lr = oe, ar = [oe, nr, tr];
39
+ function ae(s) {
40
+ return s != null && s !== "";
41
41
  }
42
- const rn = {
42
+ const or = {
43
43
  number: "number",
44
44
  integer: "number",
45
45
  date: "date",
46
46
  datetime: "datetime-local",
47
47
  time: "time"
48
48
  };
49
- function ln(d) {
50
- return rn[d] ?? "text";
49
+ function sr(s) {
50
+ return or[s] ?? "text";
51
51
  }
52
- function an(d, o) {
53
- if (o !== "") {
54
- if (d === "number") {
55
- const u = parseFloat(o);
56
- return Number.isFinite(u) ? u : o;
52
+ function ir(s, i) {
53
+ if (i !== "") {
54
+ if (s === "number") {
55
+ const d = parseFloat(i);
56
+ return Number.isFinite(d) ? d : i;
57
57
  }
58
- if (d === "integer") {
59
- const u = parseInt(o, 10);
60
- return Number.isFinite(u) ? u : o;
58
+ if (s === "integer") {
59
+ const d = parseInt(i, 10);
60
+ return Number.isFinite(d) ? d : i;
61
61
  }
62
- return o;
62
+ return i;
63
63
  }
64
64
  }
65
- function sn(d, o) {
65
+ const cr = {
66
+ showAllWells: "Show all wells",
67
+ hideEmptyWells: "Hide empty wells",
68
+ groupBy: "Group by",
69
+ groupByPlaceholder: "Group by…",
70
+ noGrouping: "No grouping",
71
+ selectedColumn: "Selected",
72
+ wellColumn: "Well",
73
+ emptyRows: "No rows. Paint wells on the plate.",
74
+ rowsPerPage: "Rows per page",
75
+ previousPage: "Prev",
76
+ nextPage: "Next",
77
+ blankGroup: "(blank)",
78
+ filter: "Filter",
79
+ filterValuePlaceholder: "Value…",
80
+ clearFilters: "Clear all",
81
+ rowSummary: (s, i) => `${s} rows · ${i} selected`,
82
+ groupRowCount: (s) => `(${s} ${s === 1 ? "row" : "rows"})`,
83
+ pageRange: (s, i, d) => d === 0 ? "0 of 0" : `${s}–${i} of ${d}`
84
+ };
85
+ function dr(s, i) {
86
+ if (!i) return s;
87
+ const d = { ...s };
88
+ for (const [u, g] of Object.entries(i))
89
+ g !== void 0 && (d[u] = g);
90
+ return d;
91
+ }
92
+ function ur(s, i, d) {
66
93
  const u = /* @__PURE__ */ new Map();
67
- for (const c of d) {
68
- const p = c.row[o], b = p == null || p === "" ? "(blank)" : String(p), g = u.get(b);
69
- g ? g.rows.push(c) : u.set(b, { key: b, rows: [c] });
94
+ for (const g of s) {
95
+ const x = g.row[i], b = x == null || x === "" ? d : String(x), h = u.get(b);
96
+ h ? h.rows.push(g) : u.set(b, { key: b, rows: [g] });
70
97
  }
71
98
  return [...u.values()];
72
99
  }
73
- function on(d) {
74
- return d.filter((o) => !!o.field).map((o) => ({ columnId: o.field, label: o.header }));
100
+ function mr(s) {
101
+ return s.filter((i) => !!i.field).map((i) => ({ columnId: i.field, label: i.header }));
75
102
  }
76
- function Sn({
77
- values: d,
78
- columns: o,
79
- fields: u,
80
- selection: c,
81
- onSelectionChange: p,
82
- onChange: b,
83
- emptyEntry: g,
84
- isPopulated: m,
85
- pageSize: x = nn,
86
- pageSizeOptions: ae = tn,
103
+ function Pr({
104
+ values: s,
105
+ columns: i,
106
+ fields: d,
107
+ selection: u,
108
+ onSelectionChange: g,
109
+ onChange: x,
110
+ emptyEntry: b,
111
+ isPopulated: h,
112
+ pageSize: w = lr,
113
+ pageSizeOptions: se = ar,
87
114
  enableFillDown: Z = !0,
88
- rowProps: se,
89
- filterable: D = !1,
90
- filterColumns: U,
91
- groupable: G = !1,
92
- className: ie
115
+ rowProps: ie,
116
+ filterable: I = !1,
117
+ filterColumns: O,
118
+ groupable: B = !1,
119
+ defaultGroupBy: ce = "",
120
+ labels: K,
121
+ className: de
93
122
  }) {
94
- const [T, oe] = h.useState(!1), [w, k] = h.useState(0), [C, de] = h.useState(x), [E, ce] = h.useState([]), [A, ue] = h.useState(""), [he, me] = h.useState(/* @__PURE__ */ new Set());
95
- h.useEffect(() => {
96
- k(0);
97
- }, [T]);
98
- const K = h.useMemo(() => {
123
+ const m = p.useMemo(() => dr(cr, K), [K]), [M, ue] = p.useState(!1), [v, E] = p.useState(0), [C, me] = p.useState(w), [P, he] = p.useState([]), [T, pe] = p.useState(ce), [fe, ge] = p.useState(/* @__PURE__ */ new Set());
124
+ p.useEffect(() => {
125
+ E(0);
126
+ }, [M]);
127
+ const Y = p.useMemo(() => {
99
128
  const e = /* @__PURE__ */ new Map();
100
- return (u ?? []).forEach((n) => e.set(n.key, n)), e;
101
- }, [u]), fe = h.useMemo(
102
- () => U ?? on(o),
103
- [o, U]
104
- ), v = h.useMemo(() => {
105
- const e = [...d.entries()].map(([r, l]) => ({
106
- id: r,
129
+ return (d ?? []).forEach((n) => e.set(n.key, n)), e;
130
+ }, [d]), be = p.useMemo(
131
+ () => O ?? mr(i),
132
+ [i, O]
133
+ ), y = p.useMemo(() => {
134
+ const e = [...s.entries()].map(([t, l]) => ({
135
+ id: t,
107
136
  row: l
108
137
  }));
109
138
  let n = e;
110
- if (!T && m && (n = e.filter((r) => m(r.row))), D && E.length > 0 && (n = n.filter((r) => {
111
- const l = r.row;
112
- return E.every((a) => {
113
- const s = l[a.columnId], f = s == null ? "" : String(s);
114
- return $e(f, a.operator, a.value);
139
+ if (!M && h && (n = e.filter((t) => h(t.row))), I && P.length > 0 && (n = n.filter((t) => {
140
+ const l = t.row;
141
+ return P.every((a) => {
142
+ const o = l[a.columnId], f = o == null ? "" : String(o);
143
+ return Ue(f, a.operator, a.value);
115
144
  });
116
- })), c && c.size > 0) {
117
- const r = new Set(n.map((l) => l.id));
118
- c.forEach((l) => {
119
- !r.has(l) && !d.has(l) && (n = [...n, { id: l, row: g(l) }]);
145
+ })), u && u.size > 0) {
146
+ const t = new Set(n.map((l) => l.id));
147
+ u.forEach((l) => {
148
+ !t.has(l) && !s.has(l) && (n = [...n, { id: l, row: b(l) }]);
120
149
  });
121
150
  }
122
- return n.sort((r, l) => r.id.localeCompare(l.id));
123
- }, [d, T, m, c, g, D, E]);
124
- h.useEffect(() => {
125
- k(0);
126
- }, [E]);
127
- const L = h.useMemo(
128
- () => v.slice(w * C, w * C + C),
129
- [v, w, C]
151
+ return n.sort((t, l) => t.id.localeCompare(l.id));
152
+ }, [s, M, h, u, b, I, P]);
153
+ p.useEffect(() => {
154
+ E(0);
155
+ }, [P]);
156
+ const D = p.useMemo(
157
+ () => y.slice(v * C, v * C + C),
158
+ [y, v, C]
130
159
  ), S = (e, n) => {
131
- const r = new Map(d), l = r.get(e) ?? g(e);
132
- r.set(e, { ...l, ...n }), b(r);
133
- }, pe = (e) => {
134
- if (!p) return;
135
- const n = new Set(c ?? []);
136
- n.has(e) ? n.delete(e) : n.add(e), p(n);
137
- }, O = (e) => {
160
+ const t = new Map(s), l = t.get(e) ?? b(e);
161
+ t.set(e, { ...l, ...n }), x(t);
162
+ }, xe = (e) => {
163
+ if (!g) return;
164
+ const n = new Set(u ?? []);
165
+ n.has(e) ? n.delete(e) : n.add(e), g(n);
166
+ }, q = (e) => {
138
167
  if (!e.field) return null;
139
- const n = !!c && c.size > 0, l = n ? v.filter(({ id: N }) => c.has(N)) : G && !!A ? v : L, a = l.findIndex(({ row: N }) => re(N[e.field]));
168
+ const n = !!u && u.size > 0, l = n ? y.filter(({ id: N }) => u.has(N)) : B && !!T ? y : D, a = l.findIndex(({ row: N }) => ae(N[e.field]));
140
169
  if (a < 0) return null;
141
- const s = l[a], f = n ? l.filter(({ id: N }) => N !== s.id) : l.slice(a + 1);
170
+ const o = l[a], f = n ? l.filter(({ id: N }) => N !== o.id) : l.slice(a + 1);
142
171
  return {
143
172
  field: e.field,
144
- source: s,
173
+ source: o,
145
174
  targets: f,
146
- value: s.row[e.field]
175
+ value: o.row[e.field]
147
176
  };
148
- }, ge = (e) => {
149
- const n = O(e);
177
+ }, we = (e) => {
178
+ const n = q(e);
150
179
  if (!n || n.targets.length === 0) return;
151
- const r = new Map(d);
180
+ const t = new Map(s);
152
181
  n.targets.forEach(({ id: l }) => {
153
- const a = r.get(l) ?? g(l);
154
- r.set(l, { ...a, [n.field]: n.value });
155
- }), b(r);
156
- }, be = (e, n, r, l, a) => /* @__PURE__ */ i(
157
- B,
182
+ const a = t.get(l) ?? b(l);
183
+ t.set(l, { ...a, [n.field]: n.value });
184
+ }), x(t);
185
+ }, Ce = (e, n, t, l, a) => /* @__PURE__ */ c(
186
+ V,
158
187
  {
159
- value: r ?? "",
160
- onValueChange: (s) => S(l, { [n]: s }),
188
+ value: t ?? "",
189
+ onValueChange: (o) => S(l, { [n]: o }),
161
190
  children: [
162
- /* @__PURE__ */ t(V, { size: "sm", className: I("h-7 w-full", j), "aria-label": a, children: /* @__PURE__ */ t(W, { placeholder: e.placeholder ?? "Select…" }) }),
163
- /* @__PURE__ */ t($, { children: (e.options ?? []).map((s) => /* @__PURE__ */ t(P, { value: s.value, children: /* @__PURE__ */ i("span", { className: "inline-flex items-center gap-2", children: [
164
- s.swatch ? /* @__PURE__ */ t(
191
+ /* @__PURE__ */ r(W, { size: "sm", className: L("h-7 w-full", U), "aria-label": a, children: /* @__PURE__ */ r($, { placeholder: e.placeholder ?? "Select…" }) }),
192
+ /* @__PURE__ */ r(j, { children: (e.options ?? []).map((o) => /* @__PURE__ */ r(R, { value: o.value, children: /* @__PURE__ */ c("span", { className: "inline-flex items-center gap-2", children: [
193
+ o.swatch ? /* @__PURE__ */ r(
165
194
  "span",
166
195
  {
167
196
  className: "inline-block h-2.5 w-2.5 rounded-sm border border-foreground/20",
168
- style: { backgroundColor: s.swatch },
197
+ style: { backgroundColor: o.swatch },
169
198
  "aria-hidden": !0
170
199
  }
171
200
  ) : null,
172
- s.label
173
- ] }) }, s.value)) })
201
+ o.label
202
+ ] }) }, o.value)) })
174
203
  ]
175
204
  }
176
- ), xe = (e, n, r, l, a) => {
177
- const s = !!r;
178
- return e.boolStyle === "switch" ? /* @__PURE__ */ t(
179
- je,
205
+ ), ve = (e, n, t, l, a) => {
206
+ const o = !!t;
207
+ return e.boolStyle === "switch" ? /* @__PURE__ */ r(
208
+ Oe,
180
209
  {
181
210
  "aria-label": a,
182
- checked: s,
211
+ checked: o,
183
212
  onCheckedChange: (f) => S(l, { [n]: f })
184
213
  }
185
- ) : /* @__PURE__ */ t(
186
- te,
214
+ ) : /* @__PURE__ */ r(
215
+ le,
187
216
  {
188
217
  "aria-label": a,
189
- checked: s,
218
+ checked: o,
190
219
  onCheckedChange: (f) => S(l, { [n]: f === !0 })
191
220
  }
192
221
  );
193
- }, Ce = (e, n, r, l, a) => /* @__PURE__ */ t(
194
- He,
222
+ }, ye = (e, n, t, l, a) => /* @__PURE__ */ r(
223
+ Ze,
195
224
  {
196
- type: ln(e.kind),
225
+ type: sr(e.kind),
197
226
  step: e.kind === "integer" ? 1 : void 0,
198
227
  placeholder: e.placeholder,
199
228
  "aria-label": a,
200
- className: I("h-7", j),
201
- value: r ?? "",
202
- onChange: (s) => S(l, { [n]: an(e.kind, s.target.value) })
229
+ className: L("h-7", U),
230
+ value: t ?? "",
231
+ onChange: (o) => S(l, { [n]: ir(e.kind, o.target.value) })
203
232
  }
204
- ), we = (e, n, r, l) => {
205
- const a = n.field, s = l[a], f = `${e.label} for ${r}`;
206
- if (e.kind === "select") return be(e, a, s, r, f);
233
+ ), Ne = (e, n, t, l) => {
234
+ const a = n.field, o = l[a], f = `${e.label} for ${t}`;
235
+ if (e.kind === "select") return Ce(e, a, o, t, f);
207
236
  if (e.kind === "multiselect") {
208
- const N = Array.isArray(s) ? s : [];
209
- return /* @__PURE__ */ t(
210
- Qe,
237
+ const N = Array.isArray(o) ? o : [];
238
+ return /* @__PURE__ */ r(
239
+ rr,
211
240
  {
212
241
  ariaLabel: f,
213
242
  value: N,
214
243
  options: e.options ?? [],
215
244
  placeholder: e.placeholder,
216
- onChange: (X) => S(r, { [a]: X.length === 0 ? void 0 : X })
245
+ onChange: (re) => S(t, { [a]: re.length === 0 ? void 0 : re })
217
246
  }
218
247
  );
219
248
  }
220
- return e.kind === "boolean" ? xe(e, a, s, r, f) : Ce(e, a, s, r, f);
221
- }, ve = (e, n) => {
249
+ return e.kind === "boolean" ? ve(e, a, o, t, f) : ye(e, a, o, t, f);
250
+ }, Se = (e, n) => {
222
251
  if (e?.kind === "select") {
223
- const r = (e.options ?? []).find((l) => l.value === n);
224
- return r ? /* @__PURE__ */ i(ne, { variant: "secondary", children: [
225
- r.swatch ? /* @__PURE__ */ t(
252
+ const t = (e.options ?? []).find((l) => l.value === n);
253
+ return t ? /* @__PURE__ */ c(te, { variant: "secondary", children: [
254
+ t.swatch ? /* @__PURE__ */ r(
226
255
  "span",
227
256
  {
228
257
  className: "size-2 rounded-sm border border-foreground/20",
229
- style: { backgroundColor: r.swatch },
258
+ style: { backgroundColor: t.swatch },
230
259
  "aria-hidden": !0
231
260
  }
232
261
  ) : null,
233
- r.label
234
- ] }) : /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "—" });
262
+ t.label
263
+ ] }) : /* @__PURE__ */ r("span", { className: "text-muted-foreground", children: "—" });
235
264
  }
236
265
  if (e?.kind === "multiselect") {
237
- const r = Array.isArray(n) ? n : [];
238
- return r.length === 0 ? /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "—" }) : /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-1", children: r.map((l) => {
239
- const a = (e.options ?? []).find((s) => s.value === l);
240
- return /* @__PURE__ */ i(ne, { variant: "secondary", children: [
241
- a?.swatch ? /* @__PURE__ */ t(
266
+ const t = Array.isArray(n) ? n : [];
267
+ return t.length === 0 ? /* @__PURE__ */ r("span", { className: "text-muted-foreground", children: "—" }) : /* @__PURE__ */ r("div", { className: "flex flex-wrap gap-1", children: t.map((l) => {
268
+ const a = (e.options ?? []).find((o) => o.value === l);
269
+ return /* @__PURE__ */ c(te, { variant: "secondary", children: [
270
+ a?.swatch ? /* @__PURE__ */ r(
242
271
  "span",
243
272
  {
244
273
  className: "size-2 rounded-sm border border-foreground/20",
@@ -250,27 +279,27 @@ function Sn({
250
279
  ] }, l);
251
280
  }) });
252
281
  }
253
- return e?.kind === "boolean" ? n ? /* @__PURE__ */ t(ee, { "aria-label": "Yes", className: "size-4 text-foreground" }) : /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "—" }) : re(n) ? String(n) : /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "—" });
254
- }, Ne = (e, n, r) => {
282
+ return e?.kind === "boolean" ? n ? /* @__PURE__ */ r(ne, { "aria-label": "Yes", className: "size-4 text-foreground" }) : /* @__PURE__ */ r("span", { className: "text-muted-foreground", children: "—" }) : ae(n) ? String(n) : /* @__PURE__ */ r("span", { className: "text-muted-foreground", children: "—" });
283
+ }, ke = (e, n, t) => {
255
284
  if (e.render)
256
285
  return e.render({
257
- row: r,
286
+ row: t,
258
287
  wellId: n,
259
- update: (s) => S(n, s)
288
+ update: (o) => S(n, o)
260
289
  });
261
290
  if (!e.field) return null;
262
- const l = K.get(e.field), a = r[e.field];
263
- return l?.editableInTable && l.kind !== "custom" ? we(l, e, n, r) : ve(l, a);
264
- }, Se = (e) => {
265
- const n = e.field ? K.get(e.field) : void 0, r = e.icon ?? n?.icon, l = Z ? O(e) : null, a = !!l && l.targets.length > 0, s = c && c.size > 0 ? `Fill selected ${e.header} cells from the first selected value` : `Fill visible ${e.header} cells downward from the first value`;
266
- return /* @__PURE__ */ i("span", { className: "flex min-w-0 items-center justify-between gap-2", children: [
267
- /* @__PURE__ */ i("span", { className: "inline-flex min-w-0 items-center gap-1.5", children: [
268
- r ? /* @__PURE__ */ t("span", { className: "inline-flex text-muted-foreground [&_svg]:size-3.5", children: r }) : null,
269
- /* @__PURE__ */ t("span", { className: "truncate", children: e.header })
291
+ const l = Y.get(e.field), a = t[e.field];
292
+ return l?.editableInTable && l.kind !== "custom" ? Ne(l, e, n, t) : Se(l, a);
293
+ }, Ee = (e) => {
294
+ const n = e.field ? Y.get(e.field) : void 0, t = e.icon ?? n?.icon, l = Z ? q(e) : null, a = !!l && l.targets.length > 0, o = u && u.size > 0 ? `Fill selected ${e.header} cells from the first selected value` : `Fill visible ${e.header} cells downward from the first value`;
295
+ return /* @__PURE__ */ c("span", { className: "flex min-w-0 items-center justify-between gap-2", children: [
296
+ /* @__PURE__ */ c("span", { className: "inline-flex min-w-0 items-center gap-1.5", children: [
297
+ t ? /* @__PURE__ */ r("span", { className: "inline-flex text-muted-foreground [&_svg]:size-3.5", children: t }) : null,
298
+ /* @__PURE__ */ r("span", { className: "truncate", children: e.header })
270
299
  ] }),
271
- Z && e.field ? /* @__PURE__ */ i(Ye, { children: [
272
- /* @__PURE__ */ t(qe, { asChild: !0, children: /* @__PURE__ */ t(
273
- F,
300
+ Z && e.field ? /* @__PURE__ */ c(Qe, { children: [
301
+ /* @__PURE__ */ r(Xe, { asChild: !0, children: /* @__PURE__ */ r(
302
+ z,
274
303
  {
275
304
  type: "button",
276
305
  variant: "ghost",
@@ -279,143 +308,146 @@ function Sn({
279
308
  disabled: !a,
280
309
  "aria-label": `Fill down ${e.header}`,
281
310
  onClick: (f) => {
282
- f.preventDefault(), f.stopPropagation(), ge(e);
311
+ f.preventDefault(), f.stopPropagation(), we(e);
283
312
  },
284
- children: /* @__PURE__ */ t(Te, {})
313
+ children: /* @__PURE__ */ r(ze, {})
285
314
  }
286
315
  ) }),
287
- /* @__PURE__ */ t(Je, { children: s })
316
+ /* @__PURE__ */ r(er, { children: o })
288
317
  ] }) : null
289
318
  ] });
290
- }, ye = h.useMemo(() => o.filter((e) => !!e.field), [o]), y = G && A ? A : "", _ = h.useMemo(
291
- () => y ? sn(v, y) : null,
292
- [y, v]
293
- ), z = v.length, Y = Math.max(0, Math.ceil(z / C) - 1), ke = c?.size ?? 0, q = o.length + 1 + (p ? 1 : 0), J = (e, n) => {
294
- const r = c?.has(e), l = se?.({ wellId: e, row: n, isSelected: !!r });
295
- return /* @__PURE__ */ i(R, { ...l, children: [
296
- p ? /* @__PURE__ */ t(M, { className: "w-10", children: /* @__PURE__ */ t(te, { checked: !!r, onCheckedChange: () => pe(e), "aria-label": `Select ${e}` }) }) : null,
297
- /* @__PURE__ */ t(M, { className: "font-semibold", children: e }),
298
- o.map((a) => /* @__PURE__ */ t(
299
- M,
319
+ }, Pe = p.useMemo(() => i.filter((e) => !!e.field), [i]), k = B && T ? T : "", A = p.useMemo(
320
+ () => k ? ur(y, k, m.blankGroup) : null,
321
+ [k, y, m.blankGroup]
322
+ ), F = y.length, J = Math.max(0, Math.ceil(F / C) - 1), Ae = u?.size ?? 0, Q = i.length + 1 + (g ? 1 : 0), X = (e, n) => {
323
+ const t = u?.has(e), l = ie?.({ wellId: e, row: n, isSelected: !!t });
324
+ return /* @__PURE__ */ c(G, { ...l, children: [
325
+ g ? /* @__PURE__ */ r(_, { className: "w-10", children: /* @__PURE__ */ r(le, { checked: !!t, onCheckedChange: () => xe(e), "aria-label": `Select ${e}` }) }) : null,
326
+ /* @__PURE__ */ r(_, { className: "font-semibold", children: e }),
327
+ i.map((a) => /* @__PURE__ */ r(
328
+ _,
300
329
  {
301
330
  style: a.minWidth ? { minWidth: a.minWidth } : void 0,
302
- children: Ne(a, e, n)
331
+ children: ke(a, e, n)
303
332
  },
304
333
  a.id ?? a.field ?? a.header
305
334
  ))
306
335
  ] }, e);
307
- }, Q = (e) => {
308
- me((n) => {
309
- const r = new Set(n);
310
- return r.has(e) ? r.delete(e) : r.add(e), r;
336
+ }, ee = (e) => {
337
+ ge((n) => {
338
+ const t = new Set(n);
339
+ return t.has(e) ? t.delete(e) : t.add(e), t;
311
340
  });
312
- }, Ee = y ? o.find((n) => n.field === y)?.header ?? y : "";
313
- return /* @__PURE__ */ i("div", { "data-slot": "well-manifest-table", className: I("flex flex-col gap-2", ie), children: [
314
- /* @__PURE__ */ i("div", { className: "flex flex-wrap items-center gap-2", children: [
315
- /* @__PURE__ */ t(F, { variant: "outline", size: "sm", onClick: () => oe((e) => !e), children: T ? "Hide empty wells" : "Show all wells" }),
316
- D ? /* @__PURE__ */ t(Ae, { columns: fe, filters: E, onFiltersChange: ce }) : null,
317
- G ? /* @__PURE__ */ i("div", { className: "inline-flex items-center gap-1.5", children: [
318
- /* @__PURE__ */ t(_e, { "aria-hidden": !0, className: "size-3.5 text-muted-foreground" }),
319
- /* @__PURE__ */ i(B, { value: A || "__none", onValueChange: (e) => ue(e === "__none" ? "" : e), children: [
320
- /* @__PURE__ */ t(V, { size: "sm", className: "h-7 min-w-40", "aria-label": "Group by", children: /* @__PURE__ */ t(W, { placeholder: "Group by…" }) }),
321
- /* @__PURE__ */ i($, { children: [
322
- /* @__PURE__ */ t(P, { value: "__none", children: "No grouping" }),
323
- ye.map((e) => /* @__PURE__ */ t(P, { value: e.field ?? "", children: e.header }, e.id ?? e.field))
341
+ }, Fe = k ? i.find((n) => n.field === k)?.header ?? k : "";
342
+ return /* @__PURE__ */ c("div", { "data-slot": "well-manifest-table", className: L("flex flex-col gap-2", de), children: [
343
+ /* @__PURE__ */ c("div", { className: "flex flex-wrap items-center gap-2", children: [
344
+ /* @__PURE__ */ r(z, { variant: "outline", size: "sm", onClick: () => ue((e) => !e), children: M ? m.hideEmptyWells : m.showAllWells }),
345
+ I ? /* @__PURE__ */ r(
346
+ Re,
347
+ {
348
+ columns: be,
349
+ filters: P,
350
+ onFiltersChange: he,
351
+ triggerLabel: m.filter,
352
+ valuePlaceholder: m.filterValuePlaceholder,
353
+ clearAllLabel: m.clearFilters
354
+ }
355
+ ) : null,
356
+ B ? /* @__PURE__ */ c("div", { className: "inline-flex items-center gap-1.5", children: [
357
+ /* @__PURE__ */ r(_e, { "aria-hidden": !0, className: "size-3.5 text-muted-foreground" }),
358
+ /* @__PURE__ */ c(V, { value: T || "__none", onValueChange: (e) => pe(e === "__none" ? "" : e), children: [
359
+ /* @__PURE__ */ r(W, { size: "sm", className: "h-7 min-w-40", "aria-label": m.groupBy, children: /* @__PURE__ */ r($, { placeholder: m.groupByPlaceholder }) }),
360
+ /* @__PURE__ */ c(j, { children: [
361
+ /* @__PURE__ */ r(R, { value: "__none", children: m.noGrouping }),
362
+ Pe.map((e) => /* @__PURE__ */ r(R, { value: e.field ?? "", children: e.header }, e.id ?? e.field))
324
363
  ] })
325
364
  ] })
326
365
  ] }) : null,
327
- /* @__PURE__ */ i("span", { className: "text-xs text-muted-foreground", children: [
328
- z,
329
- " rows · ",
330
- ke,
331
- " selected"
332
- ] })
366
+ /* @__PURE__ */ r("span", { className: "text-xs text-muted-foreground", children: m.rowSummary(F, Ae) })
333
367
  ] }),
334
- /* @__PURE__ */ t(Oe, { children: /* @__PURE__ */ i(Ze, { "data-density": "default", children: [
335
- /* @__PURE__ */ t(Ue, { children: /* @__PURE__ */ i(R, { children: [
336
- p ? /* @__PURE__ */ t(H, { className: "w-10 text-center", children: /* @__PURE__ */ i("span", { className: "inline-flex items-center justify-center text-muted-foreground [&_svg]:size-3.5", children: [
337
- /* @__PURE__ */ t(ee, { "aria-hidden": !0 }),
338
- /* @__PURE__ */ t("span", { className: "sr-only", children: "Selected" })
368
+ /* @__PURE__ */ r(Je, { children: /* @__PURE__ */ c(Ke, { "data-density": "default", children: [
369
+ /* @__PURE__ */ r(Ye, { children: /* @__PURE__ */ c(G, { children: [
370
+ g ? /* @__PURE__ */ r(H, { className: "w-10 text-center", children: /* @__PURE__ */ c("span", { className: "inline-flex items-center justify-center text-muted-foreground [&_svg]:size-3.5", children: [
371
+ /* @__PURE__ */ r(ne, { "aria-hidden": !0 }),
372
+ /* @__PURE__ */ r("span", { className: "sr-only", children: m.selectedColumn })
339
373
  ] }) }) : null,
340
- /* @__PURE__ */ t(H, { style: { minWidth: 60 }, children: "Well" }),
341
- o.map((e) => /* @__PURE__ */ t(
374
+ /* @__PURE__ */ r(H, { style: { minWidth: 60 }, children: m.wellColumn }),
375
+ i.map((e) => /* @__PURE__ */ r(
342
376
  H,
343
377
  {
344
378
  style: e.minWidth ? { minWidth: e.minWidth } : void 0,
345
- children: Se(e)
379
+ children: Ee(e)
346
380
  },
347
381
  e.id ?? e.field ?? e.header
348
382
  ))
349
383
  ] }) }),
350
- /* @__PURE__ */ i(Ke, { children: [
351
- _ ? _.map((e) => {
352
- const n = he.has(e.key);
353
- return /* @__PURE__ */ i(h.Fragment, { children: [
354
- /* @__PURE__ */ t(
355
- R,
384
+ /* @__PURE__ */ c(qe, { children: [
385
+ A ? A.map((e) => {
386
+ const n = fe.has(e.key);
387
+ return /* @__PURE__ */ c(p.Fragment, { children: [
388
+ /* @__PURE__ */ r(
389
+ G,
356
390
  {
357
391
  className: "cursor-pointer bg-muted/40",
358
- onClick: () => Q(e.key),
359
- onKeyDown: (r) => {
360
- (r.key === "Enter" || r.key === " ") && (r.preventDefault(), Q(e.key));
392
+ onClick: () => ee(e.key),
393
+ onKeyDown: (t) => {
394
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), ee(e.key));
361
395
  },
362
396
  role: "button",
363
397
  tabIndex: 0,
364
398
  "aria-expanded": !n,
365
- children: /* @__PURE__ */ t(M, { colSpan: q, className: "py-1.5", children: /* @__PURE__ */ i("div", { className: "flex items-center gap-2 text-xs font-medium", children: [
366
- n ? /* @__PURE__ */ t(ze, { "aria-hidden": !0, className: "size-3.5 text-muted-foreground" }) : /* @__PURE__ */ t(Me, { "aria-hidden": !0, className: "size-3.5 text-muted-foreground" }),
367
- /* @__PURE__ */ i("span", { children: [
368
- Ee,
399
+ children: /* @__PURE__ */ r(_, { colSpan: Q, className: "py-1.5", children: /* @__PURE__ */ c("div", { className: "flex items-center gap-2 text-xs font-medium", children: [
400
+ n ? /* @__PURE__ */ r(Me, { "aria-hidden": !0, className: "size-3.5 text-muted-foreground" }) : /* @__PURE__ */ r(Te, { "aria-hidden": !0, className: "size-3.5 text-muted-foreground" }),
401
+ /* @__PURE__ */ c("span", { children: [
402
+ Fe,
369
403
  ": ",
370
404
  e.key
371
405
  ] }),
372
- /* @__PURE__ */ i("span", { className: "text-muted-foreground", children: [
373
- "(",
374
- e.rows.length,
375
- " ",
376
- e.rows.length === 1 ? "row" : "rows",
377
- ")"
378
- ] })
406
+ /* @__PURE__ */ r("span", { className: "text-muted-foreground", children: m.groupRowCount(e.rows.length) })
379
407
  ] }) })
380
408
  }
381
409
  ),
382
- n ? null : e.rows.map(({ id: r, row: l }) => J(r, l))
410
+ n ? null : e.rows.map(({ id: t, row: l }) => X(t, l))
383
411
  ] }, e.key);
384
- }) : L.map(({ id: e, row: n }) => J(e, n)),
385
- (_ ? _.length === 0 : L.length === 0) ? /* @__PURE__ */ t(R, { children: /* @__PURE__ */ t(M, { colSpan: q, className: "text-xs text-muted-foreground", children: "No rows. Paint wells on the plate." }) }) : null
412
+ }) : D.map(({ id: e, row: n }) => X(e, n)),
413
+ (A ? A.length === 0 : D.length === 0) ? /* @__PURE__ */ r(G, { children: /* @__PURE__ */ r(_, { colSpan: Q, className: "text-xs text-muted-foreground", children: m.emptyRows }) }) : null
386
414
  ] })
387
415
  ] }) }),
388
- _ ? null : /* @__PURE__ */ i("div", { className: "flex items-center justify-end gap-3 text-xs text-muted-foreground", children: [
389
- /* @__PURE__ */ t("span", { className: "text-muted-foreground", children: "Rows per page" }),
390
- /* @__PURE__ */ i(
391
- B,
416
+ A ? null : /* @__PURE__ */ c("div", { className: "flex items-center justify-end gap-3 text-xs text-muted-foreground", children: [
417
+ /* @__PURE__ */ r("span", { className: "text-muted-foreground", children: m.rowsPerPage }),
418
+ /* @__PURE__ */ c(
419
+ V,
392
420
  {
393
421
  value: String(C),
394
422
  onValueChange: (e) => {
395
- de(parseInt(e, 10)), k(0);
423
+ me(parseInt(e, 10)), E(0);
396
424
  },
397
425
  children: [
398
- /* @__PURE__ */ t(V, { size: "sm", className: "h-7 w-18", "aria-label": "Rows per page", children: /* @__PURE__ */ t(W, {}) }),
399
- /* @__PURE__ */ t($, { children: ae.map((e) => /* @__PURE__ */ t(P, { value: String(e), children: e }, e)) })
426
+ /* @__PURE__ */ r(W, { size: "sm", className: "h-7 w-18", "aria-label": m.rowsPerPage, children: /* @__PURE__ */ r($, {}) }),
427
+ /* @__PURE__ */ r(j, { children: se.map((e) => /* @__PURE__ */ r(R, { value: String(e), children: e }, e)) })
400
428
  ]
401
429
  }
402
430
  ),
403
- /* @__PURE__ */ t("span", { children: z === 0 ? "0 of 0" : `${w * C + 1}–${Math.min((w + 1) * C, z)} of ${z}` }),
404
- /* @__PURE__ */ t(F, { variant: "outline", size: "sm", disabled: w === 0, onClick: () => k((e) => Math.max(0, e - 1)), children: "Prev" }),
405
- /* @__PURE__ */ t(
406
- F,
431
+ /* @__PURE__ */ r("span", { children: m.pageRange(
432
+ F === 0 ? 0 : v * C + 1,
433
+ Math.min((v + 1) * C, F),
434
+ F
435
+ ) }),
436
+ /* @__PURE__ */ r(z, { variant: "outline", size: "sm", disabled: v === 0, onClick: () => E((e) => Math.max(0, e - 1)), children: m.previousPage }),
437
+ /* @__PURE__ */ r(
438
+ z,
407
439
  {
408
440
  variant: "outline",
409
441
  size: "sm",
410
- disabled: w >= Y,
411
- onClick: () => k((e) => Math.min(Y, e + 1)),
412
- children: "Next"
442
+ disabled: v >= J,
443
+ onClick: () => E((e) => Math.min(J, e + 1)),
444
+ children: m.nextPage
413
445
  }
414
446
  )
415
447
  ] })
416
448
  ] });
417
449
  }
418
450
  export {
419
- Sn as WellManifestTable
451
+ Pr as WellManifestTable
420
452
  };
421
453
  //# sourceMappingURL=WellManifestTable.js.map