@tetrascience-npm/tetrascience-react-ui 1.0.0-beta.156.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 (73) hide show
  1. package/README.md +113 -0
  2. package/dist/components/composed/DataAppShell/RightPanel.cjs +1 -1
  3. package/dist/components/composed/DataAppShell/RightPanel.cjs.map +1 -1
  4. package/dist/components/composed/DataAppShell/RightPanel.d.ts +11 -1
  5. package/dist/components/composed/DataAppShell/RightPanel.js +128 -126
  6. package/dist/components/composed/DataAppShell/RightPanel.js.map +1 -1
  7. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.cjs +1 -1
  8. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.cjs.map +1 -1
  9. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.d.ts +5 -1
  10. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.js +32 -30
  11. package/dist/components/composed/PlateMapEditor/ManifestFilterPopover.js.map +1 -1
  12. package/dist/components/composed/PlateMapEditor/PlateMapEditor.cjs +1 -1
  13. package/dist/components/composed/PlateMapEditor/PlateMapEditor.cjs.map +1 -1
  14. package/dist/components/composed/PlateMapEditor/PlateMapEditor.d.ts +269 -13
  15. package/dist/components/composed/PlateMapEditor/PlateMapEditor.js +392 -310
  16. package/dist/components/composed/PlateMapEditor/PlateMapEditor.js.map +1 -1
  17. package/dist/components/composed/PlateMapEditor/PlateMapForm.cjs +1 -1
  18. package/dist/components/composed/PlateMapEditor/PlateMapForm.cjs.map +1 -1
  19. package/dist/components/composed/PlateMapEditor/PlateMapForm.d.ts +5 -1
  20. package/dist/components/composed/PlateMapEditor/PlateMapForm.js +19 -15
  21. package/dist/components/composed/PlateMapEditor/PlateMapForm.js.map +1 -1
  22. package/dist/components/composed/PlateMapEditor/PlateMapGrid.cjs +1 -1
  23. package/dist/components/composed/PlateMapEditor/PlateMapGrid.cjs.map +1 -1
  24. package/dist/components/composed/PlateMapEditor/PlateMapGrid.d.ts +12 -1
  25. package/dist/components/composed/PlateMapEditor/PlateMapGrid.js +69 -63
  26. package/dist/components/composed/PlateMapEditor/PlateMapGrid.js.map +1 -1
  27. package/dist/components/composed/PlateMapEditor/PlateMapManifest.cjs +1 -1
  28. package/dist/components/composed/PlateMapEditor/PlateMapManifest.cjs.map +1 -1
  29. package/dist/components/composed/PlateMapEditor/PlateMapManifest.d.ts +13 -4
  30. package/dist/components/composed/PlateMapEditor/PlateMapManifest.js +38 -29
  31. package/dist/components/composed/PlateMapEditor/PlateMapManifest.js.map +1 -1
  32. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.cjs +1 -1
  33. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.cjs.map +1 -1
  34. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.d.ts +6 -1
  35. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.js +490 -275
  36. package/dist/components/composed/PlateMapEditor/PlatePaintGrid.js.map +1 -1
  37. package/dist/components/composed/PlateMapEditor/WellLegend.cjs +1 -1
  38. package/dist/components/composed/PlateMapEditor/WellLegend.cjs.map +1 -1
  39. package/dist/components/composed/PlateMapEditor/WellLegend.d.ts +8 -2
  40. package/dist/components/composed/PlateMapEditor/WellLegend.js +8 -7
  41. package/dist/components/composed/PlateMapEditor/WellLegend.js.map +1 -1
  42. package/dist/components/composed/PlateMapEditor/WellManifestTable.cjs +1 -1
  43. package/dist/components/composed/PlateMapEditor/WellManifestTable.cjs.map +1 -1
  44. package/dist/components/composed/PlateMapEditor/WellManifestTable.d.ts +6 -2
  45. package/dist/components/composed/PlateMapEditor/WellManifestTable.js +288 -256
  46. package/dist/components/composed/PlateMapEditor/WellManifestTable.js.map +1 -1
  47. package/dist/components/composed/PlateMapEditor/WellMetadataForm.cjs +1 -1
  48. package/dist/components/composed/PlateMapEditor/WellMetadataForm.cjs.map +1 -1
  49. package/dist/components/composed/PlateMapEditor/WellMetadataForm.d.ts +5 -1
  50. package/dist/components/composed/PlateMapEditor/WellMetadataForm.js +61 -66
  51. package/dist/components/composed/PlateMapEditor/WellMetadataForm.js.map +1 -1
  52. package/dist/components/composed/PlateMapEditor/WellQuickPaint.cjs +2 -0
  53. package/dist/components/composed/PlateMapEditor/WellQuickPaint.cjs.map +1 -0
  54. package/dist/components/composed/PlateMapEditor/WellQuickPaint.d.ts +23 -0
  55. package/dist/components/composed/PlateMapEditor/WellQuickPaint.js +75 -0
  56. package/dist/components/composed/PlateMapEditor/WellQuickPaint.js.map +1 -0
  57. package/dist/components/composed/PlateMapEditor/index.d.ts +6 -2
  58. package/dist/components/composed/PlateMapEditor/types.d.ts +65 -0
  59. package/dist/components/composed/PlateMapEditor/usePlateMapEditorState.cjs +2 -0
  60. package/dist/components/composed/PlateMapEditor/usePlateMapEditorState.cjs.map +1 -0
  61. package/dist/components/composed/PlateMapEditor/usePlateMapEditorState.d.ts +109 -0
  62. package/dist/components/composed/PlateMapEditor/usePlateMapEditorState.js +246 -0
  63. package/dist/components/composed/PlateMapEditor/usePlateMapEditorState.js.map +1 -0
  64. package/dist/composed/PlateMapEditor.cjs +1 -1
  65. package/dist/composed/PlateMapEditor.js +48 -42
  66. package/dist/composed/PlateMapEditor.js.map +1 -1
  67. package/dist/index.cjs +1 -1
  68. package/dist/index.css +1 -1
  69. package/dist/index.js +701 -695
  70. package/dist/index.js.map +1 -1
  71. package/dist/index.scoped.css +1 -1
  72. package/dist/index.tailwind.css +1 -1
  73. package/package.json +1 -1
@@ -1,341 +1,423 @@
1
- import { jsxs as v, jsx as a } from "react/jsx-runtime";
2
- import * as o from "react";
3
- import { plateOptionsFromCsvTriage as ut } from "./csvPlateTriage.js";
4
- import { PlateMapActionsMenu as mt } from "./PlateMapActionsMenu.js";
5
- import { PlateMapForm as pt } from "./PlateMapForm.js";
6
- import { PlateMapGrid as ht } from "./PlateMapGrid.js";
7
- import { PlateMapManifest as xt } from "./PlateMapManifest.js";
8
- import { PlateMapPlateSelector as vt } from "./PlateMapPlateSelector.js";
9
- import { Badge as Pt } from "../../../ui/badge.js";
10
- import { Card as F, CardContent as _, CardHeader as X, CardTitle as Z, CardAction as gt } from "../../../ui/card.js";
11
- import { cn as Mt } from "../../../lib/utils.js";
12
- const ee = "::", St = "plateBarcode", Et = "Plate Barcode";
13
- function bt(t, n) {
14
- return `${t}${ee}${n}`;
15
- }
16
- function te(t, n) {
17
- const l = `${t}${ee}`;
18
- return n.startsWith(l) ? n.slice(l.length) : void 0;
19
- }
20
- function wt(t, n) {
21
- return { ...t ?? {}, ...n };
22
- }
23
- function Ct(t, n) {
24
- const l = /* @__PURE__ */ new Map();
25
- return t.forEach((s) => l.set(s.id, s)), (n ?? []).forEach((s) => l.set(s.id, s)), [...l.values()];
26
- }
27
- function At(t, n) {
28
- const l = t.find((s) => s.id === n);
29
- return l || (n ? void 0 : t[0]);
1
+ import { jsx as t, jsxs as x } from "react/jsx-runtime";
2
+ import * as u from "react";
3
+ import { PlateMapActionsMenu as ft } from "./PlateMapActionsMenu.js";
4
+ import { PlateMapForm as ut } from "./PlateMapForm.js";
5
+ import { PlateMapGrid as xt } from "./PlateMapGrid.js";
6
+ import { PlateMapManifest as ht } from "./PlateMapManifest.js";
7
+ import { PlateMapPlateSelector as gt } from "./PlateMapPlateSelector.js";
8
+ import { usePlateMapEditorState as wt, defaultColorForWell as vt } from "./usePlateMapEditorState.js";
9
+ import { getPlateMapScopedWellId as Yt } from "./usePlateMapEditorState.js";
10
+ import { WellQuickPaint as St } from "./WellQuickPaint.js";
11
+ import { Badge as bt } from "../../../ui/badge.js";
12
+ import { Card as T, CardContent as W, CardHeader as K, CardTitle as Y, CardAction as Ct, CardFooter as Et } from "../../../ui/card.js";
13
+ import { cn as w } from "../../../lib/utils.js";
14
+ const Pt = "plateBarcode", yt = "Plate Barcode", Mt = "Sample manifest", Nt = "360px", Dt = {
15
+ sm: "@min-[640px]:flex-row @min-[640px]:items-start",
16
+ md: "@min-[768px]:flex-row @min-[768px]:items-start",
17
+ lg: "@min-[1024px]:flex-row @min-[1024px]:items-start",
18
+ xl: "@min-[1280px]:flex-row @min-[1280px]:items-start",
19
+ never: ""
20
+ }, Tt = {
21
+ sm: "@min-[640px]:w-[var(--plate-map-form-width)] @min-[640px]:shrink-0",
22
+ md: "@min-[768px]:w-[var(--plate-map-form-width)] @min-[768px]:shrink-0",
23
+ lg: "@min-[1024px]:w-[var(--plate-map-form-width)] @min-[1024px]:shrink-0",
24
+ xl: "@min-[1280px]:w-[var(--plate-map-form-width)] @min-[1280px]:shrink-0",
25
+ never: ""
26
+ };
27
+ function Wt(r, a) {
28
+ return r > 0 || !!a;
30
29
  }
31
- function Nt(t, n) {
32
- if (!n) return t;
33
- const l = /* @__PURE__ */ new Map();
34
- return t.forEach((s, m) => {
35
- const c = te(n, m);
36
- c && l.set(c, s);
37
- }), l;
30
+ function At({ title: r, badges: a }) {
31
+ return !r && !a ? null : /* @__PURE__ */ x("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
32
+ r ? /* @__PURE__ */ t("h2", { className: "text-lg font-semibold", children: r }) : /* @__PURE__ */ t("span", {}),
33
+ a ? /* @__PURE__ */ t("div", { className: "flex flex-wrap gap-2", children: a }) : null
34
+ ] });
38
35
  }
39
- function Wt({
40
- importedPlates: t,
41
- selectedPlateId: n,
42
- isControlled: l,
43
- providedPlateCount: s
36
+ function It({
37
+ visible: r,
38
+ ...a
44
39
  }) {
45
- const m = t[0]?.id;
46
- return m ? t.some((c) => c.id === n) ? void 0 : m : !l && s === 0 ? null : void 0;
47
- }
48
- function kt(t, n) {
49
- return t > 0 || !!n;
40
+ return r ? /* @__PURE__ */ t(gt, { ...a }) : null;
50
41
  }
51
- function yt(t, n) {
52
- return !t || !!n;
53
- }
54
- function zt({ title: t, badges: n }) {
55
- return !t && !n ? null : /* @__PURE__ */ v("div", { className: "flex flex-wrap items-center justify-between gap-2", children: [
56
- t ? /* @__PURE__ */ a("h2", { className: "text-lg font-semibold", children: t }) : /* @__PURE__ */ a("span", {}),
57
- n ? /* @__PURE__ */ a("div", { className: "flex flex-wrap gap-2", children: n }) : null
42
+ function Lt({
43
+ hidden: r,
44
+ title: a,
45
+ cardClassName: b,
46
+ slot: v,
47
+ manifest: C
48
+ }) {
49
+ return r ? null : /* @__PURE__ */ x(T, { size: "sm", "data-plate-map-region": "manifest", className: w("w-full min-w-0", b), children: [
50
+ a ? /* @__PURE__ */ t(K, { className: "border-b", children: /* @__PURE__ */ t(Y, { children: a }) }) : null,
51
+ /* @__PURE__ */ t(W, { className: "min-w-0", children: v ?? C })
58
52
  ] });
59
53
  }
60
- function $t({
61
- format: t,
62
- rows: n,
63
- columns: l,
64
- values: s,
65
- onChange: m,
66
- selection: c,
67
- onSelectionChange: C,
68
- fields: M,
69
- tableColumns: S,
70
- colorForWell: ne,
54
+ function Ut({
55
+ format: r,
56
+ rows: a,
57
+ columns: b,
58
+ values: v,
59
+ onChange: C,
60
+ selection: n,
61
+ onSelectionChange: E,
62
+ fields: f,
63
+ tableColumns: h,
64
+ colorForWell: $ = vt,
71
65
  emptyEntry: A,
72
- mergeOnApply: re,
73
- isPopulated: ae,
74
- cycleFieldOnWellDoubleClick: y,
75
- title: oe,
76
- badges: se,
77
- banner: le,
78
- legend: ie,
79
- formExtras: ce,
80
- formSlot: de,
81
- footer: L,
82
- plateTitle: fe = "Plate",
83
- plateToolbar: ue,
84
- plates: N,
85
- activePlateId: R,
86
- onPlateChange: E,
87
- onAddPlate: I,
88
- onRemovePlate: me,
89
- addPlateLabel: pe,
90
- removePlateLabel: he,
91
- plateSelectorLabel: xe,
92
- plateSelectorVariant: ve,
93
- plateBarcodeField: Pe,
94
- plateBarcodeColumnHeader: D = Et,
66
+ mergeOnApply: J,
67
+ isPopulated: X,
68
+ cycleFieldOnWellDoubleClick: Z,
69
+ quickPaintField: i,
70
+ staged: q,
71
+ onStagedChange: ee,
72
+ title: te,
73
+ badges: le,
74
+ banner: ae,
75
+ legend: P,
76
+ legendPlacement: I = "form",
77
+ formExtras: re,
78
+ formSlot: oe,
79
+ hideForm: ne = !1,
80
+ formPlacement: S = "start",
81
+ stackAt: L = "md",
82
+ formWidth: y = Nt,
83
+ footer: _,
84
+ plateTitle: ie = "Plate",
85
+ plateToolbar: se,
86
+ plateBanner: pe,
87
+ plateFooter: z,
88
+ plates: de,
89
+ activePlateId: ce,
90
+ onPlateChange: me,
91
+ onAddPlate: F,
92
+ onRemovePlate: fe,
93
+ addPlateLabel: ue,
94
+ removePlateLabel: xe,
95
+ plateSelectorLabel: he,
96
+ plateSelectorVariant: ge,
97
+ plateBarcodeField: B,
98
+ applyScope: we,
99
+ plateBarcodeColumnHeader: k = yt,
95
100
  hidePlateBarcodeColumn: H = !1,
96
- groups: ge,
97
- activeGroupId: Me,
98
- onGroupClick: Se,
99
- renderHoverSummary: Ee,
100
- cellSize: be,
101
- emptyWellFillColor: we,
102
- wellShape: Ce,
103
- framedPlate: Ae,
104
- wrapWell: Ne,
105
- highlightedWellIds: We,
106
- onHoveredWellChange: ke,
107
- manifestFilterable: ye,
108
- manifestGroupable: ze,
109
- autoScaleGrid: Te,
110
- minCellSize: Be,
111
- maxCellSize: Fe,
112
- className: _e,
113
- templates: Le,
114
- templateId: Re,
115
- onTemplateChange: Ie,
116
- onClearTemplate: De,
117
- onImportCsv: z,
118
- onExportCsv: He,
119
- onImportTemplate: Ke,
101
+ groups: ve,
102
+ activeGroupId: Se,
103
+ onGroupClick: be,
104
+ renderHoverSummary: Ce,
105
+ cellSize: Ee,
106
+ emptyWellFillColor: Pe,
107
+ wellShape: ye,
108
+ selectionFillMode: Me,
109
+ framedPlate: Ne,
110
+ wrapWell: De,
111
+ highlightedWellIds: Te,
112
+ onHoveredWellChange: We,
113
+ hideSelectionControls: Ae,
114
+ labels: s,
115
+ hideManifest: Ie = !1,
116
+ manifestSlot: Le,
117
+ manifestTitle: _e = Mt,
118
+ manifest: M,
119
+ manifestFilterable: ze,
120
+ manifestGroupable: Fe,
121
+ autoScaleGrid: Be,
122
+ minCellSize: ke,
123
+ maxCellSize: He,
124
+ className: Oe,
125
+ style: Re,
126
+ classNames: p,
127
+ ref: Ve,
128
+ templates: je,
129
+ templateId: Ge,
130
+ onTemplateChange: Ue,
131
+ onClearTemplate: Qe,
132
+ onImportCsv: O,
133
+ onExportCsv: Ke,
134
+ onImportTemplate: Ye,
120
135
  onExportTemplate: $e,
121
- csvAccept: je,
122
- templateAccept: Oe,
123
- label: Ue,
124
- align: Ve,
125
- side: Ge,
126
- importTemplateLabel: Ye,
127
- exportTemplateLabel: qe,
128
- importCsvLabel: Je,
129
- exportCsvLabel: Qe,
130
- clearLabel: Xe
136
+ csvAccept: Je,
137
+ templateAccept: Xe,
138
+ label: Ze,
139
+ align: qe,
140
+ side: et,
141
+ importTemplateLabel: tt,
142
+ exportTemplateLabel: lt,
143
+ importCsvLabel: at,
144
+ exportCsvLabel: rt,
145
+ clearLabel: ot
131
146
  }) {
132
- const [K, $] = o.useState({}), [Ze, j] = o.useState(null), [O, U] = o.useState(), [V, et] = o.useState([]), [tt, G] = o.useState(), nt = re ?? wt, W = o.useMemo(() => Ct(V, N), [V, N]), P = R !== void 0, k = R ?? tt, Y = o.useMemo(
133
- () => At(W, k),
134
- [W, k]
135
- ), h = Y?.barcode, d = h, p = !!d, x = Pe ?? St, q = o.useRef(d), g = o.useMemo(() => Nt(s, d), [d, s]), J = o.useCallback(
136
- (e) => !p || !d ? e : bt(d, e),
137
- [d, p]
138
- ), rt = o.useCallback(
139
- (e) => {
140
- P || G(e), E?.(e);
141
- },
142
- [P, E]
143
- ), at = o.useCallback(
144
- async (e, r) => {
145
- if (r) {
146
- const i = ut(r);
147
- et(i);
148
- const f = Wt({
149
- importedPlates: i,
150
- selectedPlateId: k,
151
- isControlled: P,
152
- providedPlateCount: N?.length ?? 0
153
- });
154
- f !== void 0 && (P || G(f ?? void 0), f && E?.(f));
155
- }
156
- await z?.(e, r);
157
- },
158
- [P, z, E, N, k]
159
- ), b = o.useCallback(
160
- (e) => !p || !h ? e : { ...e, [x]: h },
161
- [h, x, p]
162
- ), w = o.useCallback(
163
- (e) => {
164
- if (!p || !d) {
165
- m(e);
166
- return;
167
- }
168
- const r = new Map(s);
169
- [...r.keys()].forEach((i) => {
170
- te(d, i) && r.delete(i);
171
- }), e.forEach((i, f) => {
172
- r.set(J(f), b(i));
173
- }), m(r);
174
- },
175
- [d, p, m, b, J, s]
147
+ const e = wt({
148
+ values: v,
149
+ onChange: C,
150
+ selection: n,
151
+ onSelectionChange: E,
152
+ emptyEntry: A,
153
+ mergeOnApply: J,
154
+ staged: q,
155
+ onStagedChange: ee,
156
+ fields: f,
157
+ cycleFieldOnWellDoubleClick: Z,
158
+ plates: de,
159
+ activePlateId: ce,
160
+ onPlateChange: me,
161
+ plateBarcodeField: B,
162
+ applyScope: we,
163
+ onImportCsv: O
164
+ });
165
+ u.useImperativeHandle(
166
+ Ve,
167
+ () => ({
168
+ apply: (l) => e.applyStagedToSelection(l),
169
+ clear: (l) => e.clearWells(l),
170
+ setStaged: (l) => e.setStaged(l),
171
+ getStaged: () => e.staged
172
+ }),
173
+ [e]
176
174
  );
177
- o.useEffect(() => {
178
- q.current !== d && (q.current = d, $({}), j(null), U(void 0), c.size > 0 && C(/* @__PURE__ */ new Set()));
179
- }, [d, C, c.size]);
180
- const u = o.useMemo(() => {
181
- if (!y) return;
182
- const e = M.find((r) => r.key === y);
183
- if (!(e?.kind !== "select" || !e.options?.length))
184
- return e;
185
- }, [y, M]), ot = () => {
186
- if (c.size === 0) return;
187
- const e = new Map(g);
188
- c.forEach((r) => {
189
- const f = e.get(r) ?? A(r), T = b(nt(f, K, r));
190
- e.set(r, T);
191
- }), w(e);
192
- }, st = () => {
193
- if (c.size === 0) return;
194
- const e = new Map(g);
195
- c.forEach((r) => e.delete(r)), w(e);
196
- }, lt = o.useCallback(
197
- (e) => {
198
- if (!u?.options?.length) return;
199
- const r = new Map(g), i = r.get(e), f = i?.[u.key], T = u.options.findIndex((B) => B.value === f), Q = u.options[(T + 1) % u.options.length];
200
- if (!Q) return;
201
- const ft = i ?? A(e);
202
- r.set(e, b({ ...ft, [u.key]: Q.value })), w(r), U((B) => ({ wellId: e, key: (B?.key ?? 0) + 1 }));
203
- },
204
- [w, u, A, g, b]
205
- ), it = o.useMemo(() => !p || !h || H || S.some(
206
- (i) => i.field === x || i.id === x
207
- ) ? S : [{
208
- id: x,
209
- header: D,
175
+ const d = {
176
+ ...M,
177
+ filterable: ze ?? M?.filterable,
178
+ groupable: Fe ?? M?.groupable
179
+ }, g = B ?? Pt, N = e.activePlate?.barcode, nt = u.useMemo(() => !e.isPlateScoped || !N || H || h.some(
180
+ (o) => o.field === g || o.id === g
181
+ ) ? h : [{
182
+ id: g,
183
+ header: k,
210
184
  minWidth: 150,
211
- render: ({ row: i }) => {
212
- const f = i[x] ?? h;
213
- return /* @__PURE__ */ a(Pt, { variant: "outline", children: String(f) });
185
+ render: ({ row: o }) => {
186
+ const m = o[g] ?? N;
187
+ return /* @__PURE__ */ t(bt, { variant: "outline", children: String(m) });
188
+ }
189
+ }, ...h], [
190
+ N,
191
+ g,
192
+ H,
193
+ e.isPlateScoped,
194
+ k,
195
+ h
196
+ ]), [R, D] = u.useState(!1);
197
+ u.useEffect(() => D(!1), [n]), u.useEffect(() => {
198
+ if (!i) return;
199
+ const l = (c) => {
200
+ const o = c.target;
201
+ o?.closest?.("[data-well]") || o?.closest?.('[data-slot="well-quick-paint"]') || D(!0);
202
+ };
203
+ return document.addEventListener("pointerdown", l, !0), () => document.removeEventListener("pointerdown", l, !0);
204
+ }, [i]);
205
+ const it = u.useMemo(() => {
206
+ if (!i || n.size === 0 || R) return;
207
+ const l = f.find((m) => m.key === i);
208
+ if (l?.kind !== "select" || !l.options?.length) return;
209
+ let c, o = !0;
210
+ for (const m of n) {
211
+ const U = e.scopedValues.get(m)?.[i], Q = typeof U == "string" ? U : void 0;
212
+ if (o)
213
+ c = Q, o = !1;
214
+ else if (c !== Q) {
215
+ c = void 0;
216
+ break;
217
+ }
214
218
  }
215
- }, ...S], [h, x, H, p, D, S]), ct = kt(W.length, I), dt = yt(P, E);
216
- return /* @__PURE__ */ v("div", { "data-slot": "plate-map-editor", className: Mt("flex flex-col gap-4", _e), children: [
217
- /* @__PURE__ */ a(zt, { title: oe, badges: se }),
218
- le,
219
- /* @__PURE__ */ v("div", { className: "flex flex-wrap gap-3 md:flex-nowrap", children: [
220
- /* @__PURE__ */ a(F, { className: "flex w-full max-w-[360px] min-w-[300px] basis-[360px] flex-col", size: "sm", children: /* @__PURE__ */ a(_, { className: "flex h-full flex-1 flex-col gap-3", children: /* @__PURE__ */ a(
221
- pt,
219
+ return /* @__PURE__ */ t(
220
+ St,
221
+ {
222
+ options: l.options,
223
+ activeValue: c,
224
+ selectionSize: n.size,
225
+ onPick: (m) => {
226
+ e.applyToSelection({ [i]: m }), D(!0);
227
+ }
228
+ }
229
+ );
230
+ }, [f, R, i, n, e]), st = Wt(e.availablePlates.length, F), pt = I === "plate" && P ? /* @__PURE__ */ t("div", { className: "mt-3 border-t pt-3", children: P }) : void 0, V = S === "top" || S === "bottom", dt = S === "start" || S === "top", ct = typeof y == "number" ? `${y}px` : y, j = ne ? null : /* @__PURE__ */ t(
231
+ T,
232
+ {
233
+ "data-plate-map-region": "form",
234
+ className: w(
235
+ // Full-width and free to shrink by default; the fixed column width only
236
+ // applies from `stackAt` up, which is what keeps narrow viewports clean.
237
+ "flex w-full min-w-0 flex-col",
238
+ !V && Tt[L],
239
+ p?.formCard
240
+ ),
241
+ size: "sm",
242
+ children: /* @__PURE__ */ t(W, { className: "flex h-full flex-1 flex-col gap-3", children: /* @__PURE__ */ t(
243
+ ut,
222
244
  {
223
- fields: M,
224
- value: K,
225
- onChange: $,
226
- selectionSize: c.size,
227
- onApply: ot,
228
- onClear: st,
229
- extras: ce,
230
- legend: ie,
231
- formSlot: de
245
+ fields: f,
246
+ value: e.staged,
247
+ onChange: e.setStaged,
248
+ selectionSize: n.size,
249
+ onApply: e.applyStagedToSelection,
250
+ onClear: e.clearWells,
251
+ applyLabel: s?.apply,
252
+ clearLabel: s?.clearWells,
253
+ selectionEmptyLabel: s?.selectionEmpty,
254
+ selectionCountLabel: s?.selectionCount,
255
+ extras: re,
256
+ legend: I === "form" ? P : void 0,
257
+ formSlot: oe,
258
+ className: p?.form
232
259
  }
233
- ) }) }),
234
- /* @__PURE__ */ v(F, { className: "flex min-w-[360px] flex-1 flex-col", size: "sm", children: [
235
- /* @__PURE__ */ v(X, { className: "border-b", children: [
236
- /* @__PURE__ */ v("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [
237
- /* @__PURE__ */ a(Z, { className: "min-w-0", children: fe }),
238
- ct ? /* @__PURE__ */ a(
239
- vt,
260
+ ) })
261
+ },
262
+ "form"
263
+ ), G = /* @__PURE__ */ x(
264
+ T,
265
+ {
266
+ "data-plate-map-region": "plate",
267
+ className: w("flex w-full min-w-0 flex-1 flex-col", p?.plateCard),
268
+ size: "sm",
269
+ children: [
270
+ /* @__PURE__ */ x(K, { className: "border-b", children: [
271
+ /* @__PURE__ */ x("div", { className: "flex min-w-0 flex-wrap items-center gap-2", children: [
272
+ /* @__PURE__ */ t(Y, { className: "min-w-0", children: ie }),
273
+ /* @__PURE__ */ t(
274
+ It,
240
275
  {
241
- plates: W,
242
- activePlateId: Y?.id,
243
- onPlateChange: dt ? rt : void 0,
244
- onAddPlate: I,
245
- onRemovePlate: me,
246
- addPlateLabel: pe,
247
- removePlateLabel: he,
248
- label: xe,
249
- variant: ve
276
+ visible: st,
277
+ plates: e.availablePlates,
278
+ activePlateId: e.activePlate?.id,
279
+ onPlateChange: e.canChangePlate ? e.handlePlateChange : void 0,
280
+ onAddPlate: F,
281
+ onRemovePlate: fe,
282
+ addPlateLabel: ue,
283
+ removePlateLabel: xe,
284
+ label: he,
285
+ variant: ge
250
286
  }
251
- ) : null
287
+ )
252
288
  ] }),
253
- /* @__PURE__ */ a(gt, { className: "flex flex-wrap items-center gap-2", children: /* @__PURE__ */ a(
254
- mt,
289
+ /* @__PURE__ */ t(Ct, { className: "flex flex-wrap items-center gap-2", children: /* @__PURE__ */ t(
290
+ ft,
255
291
  {
256
- templates: Le,
257
- templateId: Re,
258
- onTemplateChange: Ie,
259
- onClearTemplate: De,
260
- hasEntries: s.size > 0,
261
- onImportCsv: z ? at : void 0,
262
- onExportCsv: He,
263
- onImportTemplate: Ke,
292
+ templates: je,
293
+ templateId: Ge,
294
+ onTemplateChange: Ue,
295
+ onClearTemplate: Qe,
296
+ hasEntries: v.size > 0,
297
+ onImportCsv: O ? e.handleImportCsv : void 0,
298
+ onExportCsv: Ke,
299
+ onImportTemplate: Ye,
264
300
  onExportTemplate: $e,
265
- csvAccept: je,
266
- templateAccept: Oe,
267
- label: Ue,
268
- align: Ve,
269
- side: Ge,
270
- importTemplateLabel: Ye,
271
- exportTemplateLabel: qe,
272
- importCsvLabel: Je,
273
- exportCsvLabel: Qe,
274
- clearLabel: Xe
301
+ csvAccept: Je,
302
+ templateAccept: Xe,
303
+ label: Ze,
304
+ align: qe,
305
+ side: et,
306
+ importTemplateLabel: tt,
307
+ exportTemplateLabel: lt,
308
+ importCsvLabel: at,
309
+ exportCsvLabel: rt,
310
+ clearLabel: ot
275
311
  }
276
312
  ) })
277
313
  ] }),
278
- /* @__PURE__ */ a(_, { children: /* @__PURE__ */ a(
279
- ht,
314
+ /* @__PURE__ */ t(W, { className: "min-w-0", children: /* @__PURE__ */ t(
315
+ xt,
280
316
  {
281
- format: t,
282
- rows: n,
283
- columns: l,
284
- values: g,
285
- selection: c,
286
- onSelectionChange: C,
287
- colorForWell: ne,
288
- fields: M,
289
- renderHoverSummary: Ee,
290
- hoveredWellId: Ze,
291
- onHoveredWellChange: (e) => {
292
- j(e), ke?.(e);
317
+ format: r,
318
+ rows: a,
319
+ columns: b,
320
+ values: e.scopedValues,
321
+ selection: n,
322
+ onSelectionChange: E,
323
+ colorForWell: $,
324
+ fields: f,
325
+ renderHoverSummary: Ce,
326
+ hoveredWellId: e.hoveredWellId,
327
+ onHoveredWellChange: (l) => {
328
+ e.setHoveredWellId(l), We?.(l);
293
329
  },
294
- toolbar: ue,
295
- emptyWellFillColor: we,
296
- wellShape: Ce,
297
- framed: Ae,
298
- wrapWell: Ne,
299
- highlightedWellIds: We,
300
- onWellDoubleClick: u ? lt : void 0,
301
- selectionFillMode: u ? "well" : "selection",
302
- flashWellId: O?.wellId,
303
- flashWellKey: O?.key,
304
- cellSize: be,
305
- autoScale: Te,
306
- minCellSize: Be,
307
- maxCellSize: Fe,
308
- groups: ge,
309
- activeGroupId: Me,
310
- onGroupClick: Se
330
+ banner: pe,
331
+ toolbar: se,
332
+ footer: pt,
333
+ hideSelectionControls: Ae,
334
+ selectAllLabel: s?.selectAll,
335
+ deselectAllLabel: s?.deselectAll,
336
+ emptyWellFillColor: Pe,
337
+ wellShape: ye,
338
+ framed: Ne,
339
+ wrapWell: De,
340
+ quickPaint: it,
341
+ highlightedWellIds: Te,
342
+ onWellDoubleClick: e.cycleWellField,
343
+ selectionFillMode: Me,
344
+ flashWellId: e.flashWell?.wellId,
345
+ flashWellKey: e.flashWell?.key,
346
+ cellSize: Ee,
347
+ autoScale: Be,
348
+ minCellSize: ke,
349
+ maxCellSize: He,
350
+ groups: ve,
351
+ activeGroupId: Se,
352
+ onGroupClick: be,
353
+ className: p?.grid
311
354
  }
312
- ) })
313
- ] })
314
- ] }),
315
- /* @__PURE__ */ v(F, { size: "sm", children: [
316
- /* @__PURE__ */ a(X, { className: "border-b", children: /* @__PURE__ */ a(Z, { children: "Sample manifest" }) }),
317
- /* @__PURE__ */ a(_, { children: /* @__PURE__ */ a(
318
- xt,
319
- {
320
- values: g,
321
- onChange: w,
322
- columns: it,
323
- fields: M,
324
- selection: c,
325
- onSelectionChange: C,
326
- emptyEntry: A,
327
- isPopulated: ae,
328
- filterable: ye,
329
- groupable: ze
330
- }
331
- ) })
332
- ] }),
333
- L ? /* @__PURE__ */ a("div", { className: "flex justify-end gap-2 pt-2", children: L }) : null
355
+ ) }),
356
+ z ? /* @__PURE__ */ t(Et, { className: "flex flex-wrap items-center gap-2 border-t", children: z }) : null
357
+ ]
358
+ },
359
+ "plate"
360
+ ), mt = dt ? [j, G] : [G, j];
361
+ return /* @__PURE__ */ x("div", { "data-slot": "plate-map-editor", className: w("flex w-full min-w-0 flex-col gap-4", Oe), style: Re, children: [
362
+ /* @__PURE__ */ t(At, { title: te, badges: le }),
363
+ ae,
364
+ /* @__PURE__ */ t(
365
+ "div",
366
+ {
367
+ "data-slot": "plate-map-editor-container",
368
+ className: "@container w-full min-w-0",
369
+ style: { "--plate-map-form-width": ct },
370
+ children: /* @__PURE__ */ t(
371
+ "div",
372
+ {
373
+ "data-slot": "plate-map-editor-layout",
374
+ className: w(
375
+ "flex w-full min-w-0 flex-col gap-3",
376
+ !V && Dt[L],
377
+ p?.layout
378
+ ),
379
+ children: mt
380
+ }
381
+ )
382
+ }
383
+ ),
384
+ /* @__PURE__ */ t(
385
+ Lt,
386
+ {
387
+ hidden: Ie,
388
+ title: _e,
389
+ cardClassName: p?.manifestCard,
390
+ slot: Le,
391
+ manifest: /* @__PURE__ */ t(
392
+ ht,
393
+ {
394
+ values: e.scopedValues,
395
+ onChange: e.commitScopedValues,
396
+ columns: nt,
397
+ fields: f,
398
+ selection: n,
399
+ onSelectionChange: E,
400
+ emptyEntry: A,
401
+ isPopulated: X,
402
+ filterable: d.filterable,
403
+ filterColumns: d.filterColumns,
404
+ groupable: d.groupable,
405
+ defaultGroupBy: d.defaultGroupBy,
406
+ pageSize: d.pageSize,
407
+ pageSizeOptions: d.pageSizeOptions,
408
+ enableFillDown: d.enableFillDown,
409
+ labels: s,
410
+ className: p?.manifest
411
+ }
412
+ )
413
+ }
414
+ ),
415
+ _ ? /* @__PURE__ */ t("div", { className: "flex flex-wrap justify-end gap-2 pt-2", children: _ }) : null
334
416
  ] });
335
417
  }
336
418
  export {
337
- Pt as PlateBadge,
338
- $t as PlateMapEditor,
339
- bt as getPlateMapScopedWellId
419
+ bt as PlateBadge,
420
+ Ut as PlateMapEditor,
421
+ Yt as getPlateMapScopedWellId
340
422
  };
341
423
  //# sourceMappingURL=PlateMapEditor.js.map