@gemina/elements 0.13.1 → 0.13.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -221,7 +221,7 @@ async function readErrorEnvelope(error) {
221
221
  }
222
222
 
223
223
  // src/version.ts
224
- var VERSION = "0.13.1";
224
+ var VERSION = "0.13.3";
225
225
 
226
226
  // src/chat.tsx
227
227
  var import_jsx_runtime = require("react/jsx-runtime");
@@ -1720,8 +1720,16 @@ function forEachRowUnit(tables, plannedTables, visit) {
1720
1720
  const meta = row?.[ROW_META_KEY];
1721
1721
  return meta?.confidence ?? null;
1722
1722
  };
1723
+ const planFor = (tablePointer) => {
1724
+ const exact = plannedTables.get(tablePointer);
1725
+ if (exact !== void 0) return exact;
1726
+ for (const [serverPointer, planned] of plannedTables) {
1727
+ if (matchesTablePointer(serverPointer, tablePointer)) return planned;
1728
+ }
1729
+ return void 0;
1730
+ };
1723
1731
  for (const table of tables) {
1724
- const planned = plannedTables.get(table.pointer);
1732
+ const planned = planFor(table.pointer);
1725
1733
  if (planned) {
1726
1734
  for (const row of planned) {
1727
1735
  const { source } = row.entry;
@@ -2857,35 +2865,42 @@ function HeaderSection(props) {
2857
2865
  }
2858
2866
  function EntitySection(props) {
2859
2867
  const { entity, shared } = props;
2860
- const visibleItems = entity.items.map((item) => Object.fromEntries(
2861
- Object.entries(item).filter(([, cellValue]) => !shared.hidden.fields.has(cellValue.pointer))
2862
- )).filter((item) => Object.keys(item).length > 0);
2868
+ const visibleItems = entity.items.map((item, index) => ({
2869
+ index,
2870
+ cells: Object.fromEntries(
2871
+ Object.entries(item).filter(([, cellValue]) => !shared.hidden.fields.has(cellValue.pointer))
2872
+ )
2873
+ })).filter(({ cells }) => Object.keys(cells).length > 0);
2863
2874
  const label = formatLabel(entity.key);
2864
2875
  const singular = label.replace(/s$/, "");
2865
2876
  return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("section", { className: "gemina-verification__section", "aria-label": label, children: [
2866
2877
  /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "gemina-verification__section-header", children: [
2867
2878
  label,
2868
2879
  " (",
2869
- visibleItems.length,
2880
+ entity.items.length,
2870
2881
  ")"
2871
2882
  ] }),
2872
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "gemina-verification__section-body", children: visibleItems.map((item, itemIndex) => /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "gemina-verification__card", children: [
2873
- /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "gemina-verification__card-header", children: [
2874
- singular,
2875
- " ",
2876
- itemIndex + 1
2877
- ] }),
2878
- /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dl", { className: "gemina-verification__dl", children: Object.entries(item).map(([fieldKey, cell]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2879
- FieldPair,
2880
- {
2881
- label: formatLabel(fieldKey),
2882
- ariaLabel: `${singular} ${itemIndex + 1} \u2014 ${formatLabel(fieldKey)}`,
2883
- cell,
2884
- shared
2885
- },
2886
- fieldKey
2887
- )) })
2888
- ] }, itemIndex)) })
2883
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "gemina-verification__section-body", children: visibleItems.map(({ index, cells }) => (
2884
+ // Keyed by the original index, never the filtered position, or React
2885
+ // reuses a hidden card's DOM (and its focus) for its successor.
2886
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "gemina-verification__card", children: [
2887
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "gemina-verification__card-header", children: [
2888
+ singular,
2889
+ " ",
2890
+ index + 1
2891
+ ] }),
2892
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("dl", { className: "gemina-verification__dl", children: Object.entries(cells).map(([fieldKey, cell]) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
2893
+ FieldPair,
2894
+ {
2895
+ label: formatLabel(fieldKey),
2896
+ ariaLabel: `${singular} ${index + 1} \u2014 ${formatLabel(fieldKey)}`,
2897
+ cell,
2898
+ shared
2899
+ },
2900
+ fieldKey
2901
+ )) })
2902
+ ] }, index)
2903
+ )) })
2889
2904
  ] });
2890
2905
  }
2891
2906
  function TableRowView(props) {
@@ -3076,6 +3091,7 @@ function TableSection(props) {
3076
3091
  needsReview > 0 ? ` \xB7 ${needsReview} need review` : "",
3077
3092
  ")"
3078
3093
  ] }),
3094
+ shared.filterOn && mutable !== void 0 && !shared.readOnly ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "gemina-verification__filter-note", children: "Row editing is off while filtering" }) : null,
3079
3095
  table.overallConfidence ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("span", { className: "gemina-verification__overall-confidence", children: [
3080
3096
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { children: "Overall confidence" }),
3081
3097
  /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ConfidenceDot, { confidence: table.overallConfidence })
@@ -3824,6 +3840,10 @@ var VERIFICATION_CSS = `
3824
3840
  font-size: 12px;
3825
3841
  color: var(--gemina-verification-muted);
3826
3842
  }
3843
+ .gemina-verification__filter-note {
3844
+ font-size: 12px;
3845
+ color: var(--gemina-verification-muted);
3846
+ }
3827
3847
  .gemina-verification__all-scored {
3828
3848
  margin: 0;
3829
3849
  padding: 12px;
@@ -4542,6 +4562,7 @@ function GeminaVerification(props) {
4542
4562
  [classified, rendered, plannedTables, unmatched]
4543
4563
  );
4544
4564
  const visibleUnits = totalUnits - hidden.fields.size - hidden.rows.size;
4565
+ const allClear = filterOn && totalUnits > 0 && visibleUnits === 0;
4545
4566
  const invalidCount = (0, import_react5.useMemo)(() => {
4546
4567
  const rowLevel = pairErrors.size;
4547
4568
  if (edits.size === 0) {
@@ -4702,7 +4723,7 @@ function GeminaVerification(props) {
4702
4723
  onImageExpired: handleImageExpired
4703
4724
  }
4704
4725
  ),
4705
- /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4726
+ allClear ? /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("p", { className: "gemina-verification__all-scored", role: "status", children: `Nothing needs review \u2014 all ${totalUnits} fields scored high.` }) : /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
4706
4727
  VerificationForm,
4707
4728
  {
4708
4729
  classified,