@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.
@@ -2,7 +2,7 @@ import {
2
2
  VERSION,
3
3
  httpStatus,
4
4
  readErrorEnvelope
5
- } from "./chunk-X5TSIIUP.js";
5
+ } from "./chunk-GWTTD7QH.js";
6
6
 
7
7
  // src/verification/index.tsx
8
8
  import { useCallback as useCallback3, useEffect as useEffect3, useId as useId2, useMemo, useRef as useRef3, useState as useState3 } from "react";
@@ -855,8 +855,16 @@ function forEachRowUnit(tables, plannedTables, visit) {
855
855
  const meta = row?.[ROW_META_KEY];
856
856
  return meta?.confidence ?? null;
857
857
  };
858
+ const planFor = (tablePointer) => {
859
+ const exact = plannedTables.get(tablePointer);
860
+ if (exact !== void 0) return exact;
861
+ for (const [serverPointer, planned] of plannedTables) {
862
+ if (matchesTablePointer(serverPointer, tablePointer)) return planned;
863
+ }
864
+ return void 0;
865
+ };
858
866
  for (const table of tables) {
859
- const planned = plannedTables.get(table.pointer);
867
+ const planned = planFor(table.pointer);
860
868
  if (planned) {
861
869
  for (const row of planned) {
862
870
  const { source } = row.entry;
@@ -2001,35 +2009,42 @@ function HeaderSection(props) {
2001
2009
  }
2002
2010
  function EntitySection(props) {
2003
2011
  const { entity, shared } = props;
2004
- const visibleItems = entity.items.map((item) => Object.fromEntries(
2005
- Object.entries(item).filter(([, cellValue]) => !shared.hidden.fields.has(cellValue.pointer))
2006
- )).filter((item) => Object.keys(item).length > 0);
2012
+ const visibleItems = entity.items.map((item, index) => ({
2013
+ index,
2014
+ cells: Object.fromEntries(
2015
+ Object.entries(item).filter(([, cellValue]) => !shared.hidden.fields.has(cellValue.pointer))
2016
+ )
2017
+ })).filter(({ cells }) => Object.keys(cells).length > 0);
2007
2018
  const label = formatLabel(entity.key);
2008
2019
  const singular = label.replace(/s$/, "");
2009
2020
  return /* @__PURE__ */ jsxs3("section", { className: "gemina-verification__section", "aria-label": label, children: [
2010
2021
  /* @__PURE__ */ jsxs3("div", { className: "gemina-verification__section-header", children: [
2011
2022
  label,
2012
2023
  " (",
2013
- visibleItems.length,
2024
+ entity.items.length,
2014
2025
  ")"
2015
2026
  ] }),
2016
- /* @__PURE__ */ jsx3("div", { className: "gemina-verification__section-body", children: visibleItems.map((item, itemIndex) => /* @__PURE__ */ jsxs3("div", { className: "gemina-verification__card", children: [
2017
- /* @__PURE__ */ jsxs3("div", { className: "gemina-verification__card-header", children: [
2018
- singular,
2019
- " ",
2020
- itemIndex + 1
2021
- ] }),
2022
- /* @__PURE__ */ jsx3("dl", { className: "gemina-verification__dl", children: Object.entries(item).map(([fieldKey, cell]) => /* @__PURE__ */ jsx3(
2023
- FieldPair,
2024
- {
2025
- label: formatLabel(fieldKey),
2026
- ariaLabel: `${singular} ${itemIndex + 1} \u2014 ${formatLabel(fieldKey)}`,
2027
- cell,
2028
- shared
2029
- },
2030
- fieldKey
2031
- )) })
2032
- ] }, itemIndex)) })
2027
+ /* @__PURE__ */ jsx3("div", { className: "gemina-verification__section-body", children: visibleItems.map(({ index, cells }) => (
2028
+ // Keyed by the original index, never the filtered position, or React
2029
+ // reuses a hidden card's DOM (and its focus) for its successor.
2030
+ /* @__PURE__ */ jsxs3("div", { className: "gemina-verification__card", children: [
2031
+ /* @__PURE__ */ jsxs3("div", { className: "gemina-verification__card-header", children: [
2032
+ singular,
2033
+ " ",
2034
+ index + 1
2035
+ ] }),
2036
+ /* @__PURE__ */ jsx3("dl", { className: "gemina-verification__dl", children: Object.entries(cells).map(([fieldKey, cell]) => /* @__PURE__ */ jsx3(
2037
+ FieldPair,
2038
+ {
2039
+ label: formatLabel(fieldKey),
2040
+ ariaLabel: `${singular} ${index + 1} \u2014 ${formatLabel(fieldKey)}`,
2041
+ cell,
2042
+ shared
2043
+ },
2044
+ fieldKey
2045
+ )) })
2046
+ ] }, index)
2047
+ )) })
2033
2048
  ] });
2034
2049
  }
2035
2050
  function TableRowView(props) {
@@ -2220,6 +2235,7 @@ function TableSection(props) {
2220
2235
  needsReview > 0 ? ` \xB7 ${needsReview} need review` : "",
2221
2236
  ")"
2222
2237
  ] }),
2238
+ shared.filterOn && mutable !== void 0 && !shared.readOnly ? /* @__PURE__ */ jsx3("span", { className: "gemina-verification__filter-note", children: "Row editing is off while filtering" }) : null,
2223
2239
  table.overallConfidence ? /* @__PURE__ */ jsxs3("span", { className: "gemina-verification__overall-confidence", children: [
2224
2240
  /* @__PURE__ */ jsx3("span", { children: "Overall confidence" }),
2225
2241
  /* @__PURE__ */ jsx3(ConfidenceDot, { confidence: table.overallConfidence })
@@ -2968,6 +2984,10 @@ var VERIFICATION_CSS = `
2968
2984
  font-size: 12px;
2969
2985
  color: var(--gemina-verification-muted);
2970
2986
  }
2987
+ .gemina-verification__filter-note {
2988
+ font-size: 12px;
2989
+ color: var(--gemina-verification-muted);
2990
+ }
2971
2991
  .gemina-verification__all-scored {
2972
2992
  margin: 0;
2973
2993
  padding: 12px;
@@ -3686,6 +3706,7 @@ function GeminaVerification(props) {
3686
3706
  [classified, rendered, plannedTables, unmatched]
3687
3707
  );
3688
3708
  const visibleUnits = totalUnits - hidden.fields.size - hidden.rows.size;
3709
+ const allClear = filterOn && totalUnits > 0 && visibleUnits === 0;
3689
3710
  const invalidCount = useMemo(() => {
3690
3711
  const rowLevel = pairErrors.size;
3691
3712
  if (edits.size === 0) {
@@ -3846,7 +3867,7 @@ function GeminaVerification(props) {
3846
3867
  onImageExpired: handleImageExpired
3847
3868
  }
3848
3869
  ),
3849
- /* @__PURE__ */ jsx4(
3870
+ allClear ? /* @__PURE__ */ jsx4("p", { className: "gemina-verification__all-scored", role: "status", children: `Nothing needs review \u2014 all ${totalUnits} fields scored high.` }) : /* @__PURE__ */ jsx4(
3850
3871
  VerificationForm,
3851
3872
  {
3852
3873
  classified,
@@ -4017,4 +4038,4 @@ function GeminaVerification(props) {
4017
4038
  export {
4018
4039
  GeminaVerification
4019
4040
  };
4020
- //# sourceMappingURL=chunk-A5PZTHDE.js.map
4041
+ //# sourceMappingURL=chunk-XEWKY2DW.js.map