@gemina/elements 0.12.0 → 0.13.0
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/chat.cjs +1 -1
- package/dist/chat.cjs.map +1 -1
- package/dist/chat.js +2 -2
- package/dist/{chunk-I5APRZ3B.js → chunk-5X7CGCOV.js} +205 -16
- package/dist/chunk-5X7CGCOV.js.map +1 -0
- package/dist/{chunk-Z3OLTR2S.js → chunk-7FT4EJTY.js} +2 -2
- package/dist/{chunk-Z3OLTR2S.js.map → chunk-7FT4EJTY.js.map} +1 -1
- package/dist/{chunk-4HKLI46J.js → chunk-XFE7C6IS.js} +2 -2
- package/dist/index.cjs +204 -15
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +3 -3
- package/dist/verification.cjs +204 -15
- package/dist/verification.cjs.map +1 -1
- package/dist/verification.js +2 -2
- package/package.json +1 -1
- package/dist/chunk-I5APRZ3B.js.map +0 -1
- /package/dist/{chunk-4HKLI46J.js.map → chunk-XFE7C6IS.js.map} +0 -0
package/dist/index.d.cts
CHANGED
package/dist/index.d.ts
CHANGED
package/dist/index.js
CHANGED
|
@@ -3,13 +3,13 @@ import {
|
|
|
3
3
|
} from "./chunk-CUOHJGPN.js";
|
|
4
4
|
import {
|
|
5
5
|
GeminaChat
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-XFE7C6IS.js";
|
|
7
7
|
import {
|
|
8
8
|
GeminaVerification
|
|
9
|
-
} from "./chunk-
|
|
9
|
+
} from "./chunk-5X7CGCOV.js";
|
|
10
10
|
import {
|
|
11
11
|
VERSION
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-7FT4EJTY.js";
|
|
13
13
|
export {
|
|
14
14
|
GeminaChat,
|
|
15
15
|
GeminaTokenManager,
|
package/dist/verification.cjs
CHANGED
|
@@ -904,6 +904,98 @@ function pruneEmptyAddedRows(plannedTables, edits) {
|
|
|
904
904
|
// src/verification/form.tsx
|
|
905
905
|
var import_react3 = __toESM(require("react"), 1);
|
|
906
906
|
|
|
907
|
+
// src/verification/review-filter.ts
|
|
908
|
+
function isHighConfidence(confidence) {
|
|
909
|
+
return (confidence?.level ?? "").toLowerCase() === "high";
|
|
910
|
+
}
|
|
911
|
+
var NOTHING_HIDDEN = {
|
|
912
|
+
fields: /* @__PURE__ */ new Set(),
|
|
913
|
+
rows: /* @__PURE__ */ new Set()
|
|
914
|
+
};
|
|
915
|
+
var unplannedRowKey = (tablePointer, index) => `${tablePointer}/${index}`;
|
|
916
|
+
function computeHidden(input) {
|
|
917
|
+
const { classified, plannedTables, cellViews, bindingIndex, edits, pairErrors, suppressed } = input;
|
|
918
|
+
const fields = /* @__PURE__ */ new Set();
|
|
919
|
+
const rows = /* @__PURE__ */ new Set();
|
|
920
|
+
const touched = (editKey) => editKey !== void 0 && (edits.has(editKey) || pairErrors.has(editKey));
|
|
921
|
+
const editKeysByRow = /* @__PURE__ */ new Map();
|
|
922
|
+
for (const view of cellViews) {
|
|
923
|
+
const list = editKeysByRow.get(view.rowKey);
|
|
924
|
+
if (list) list.push(view.editKey);
|
|
925
|
+
else editKeysByRow.set(view.rowKey, [view.editKey]);
|
|
926
|
+
}
|
|
927
|
+
const considerField = (pointer, confidence) => {
|
|
928
|
+
if (suppressed.has(pointer)) return;
|
|
929
|
+
if (!isHighConfidence(confidence)) return;
|
|
930
|
+
const editKey = bindingIndex.get(pointer)?.key.raw;
|
|
931
|
+
if (editKey === void 0 || touched(editKey)) return;
|
|
932
|
+
fields.add(pointer);
|
|
933
|
+
};
|
|
934
|
+
for (const header of classified.headers) {
|
|
935
|
+
considerField(header.pointer, header.confidence);
|
|
936
|
+
}
|
|
937
|
+
for (const list of classified.simpleLists) {
|
|
938
|
+
for (const item of list.items) considerField(item.pointer, item.confidence);
|
|
939
|
+
}
|
|
940
|
+
for (const entity of classified.entities) {
|
|
941
|
+
for (const item of entity.items) {
|
|
942
|
+
for (const entityCell of Object.values(item)) considerField(entityCell.pointer, entityCell.confidence);
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
const rowConfidence = (row) => {
|
|
946
|
+
const meta = row?.[ROW_META_KEY];
|
|
947
|
+
return meta?.confidence ?? null;
|
|
948
|
+
};
|
|
949
|
+
const rowIsHidable = (rowKey) => !(editKeysByRow.get(rowKey) ?? []).some((editKey) => touched(editKey));
|
|
950
|
+
for (const table of classified.tables) {
|
|
951
|
+
const planned = plannedTables.get(table.pointer);
|
|
952
|
+
if (planned) {
|
|
953
|
+
for (const plannedRow of planned) {
|
|
954
|
+
if (plannedRow.entry.source === null) continue;
|
|
955
|
+
if (!isHighConfidence(rowConfidence(table.rows[plannedRow.entry.source]))) continue;
|
|
956
|
+
if (!rowIsHidable(plannedRow.entry.id)) continue;
|
|
957
|
+
rows.add(plannedRow.entry.id);
|
|
958
|
+
}
|
|
959
|
+
continue;
|
|
960
|
+
}
|
|
961
|
+
table.rows.forEach((row, index) => {
|
|
962
|
+
if (!isHighConfidence(rowConfidence(row))) return;
|
|
963
|
+
const key = unplannedRowKey(table.pointer, index);
|
|
964
|
+
if (!rowIsHidable(key)) return;
|
|
965
|
+
rows.add(key);
|
|
966
|
+
});
|
|
967
|
+
}
|
|
968
|
+
if (fields.size === 0 && rows.size === 0) return NOTHING_HIDDEN;
|
|
969
|
+
return { fields, rows };
|
|
970
|
+
}
|
|
971
|
+
function countUnits(classified, plannedTables, suppressed) {
|
|
972
|
+
let total = 0;
|
|
973
|
+
total += classified.headers.filter((header) => !suppressed.has(header.pointer)).length;
|
|
974
|
+
for (const list of classified.simpleLists) {
|
|
975
|
+
total += list.items.filter((item) => !suppressed.has(item.pointer)).length;
|
|
976
|
+
}
|
|
977
|
+
for (const entity of classified.entities) {
|
|
978
|
+
for (const item of entity.items) {
|
|
979
|
+
total += Object.values(item).filter((entityCell) => !suppressed.has(entityCell.pointer)).length;
|
|
980
|
+
}
|
|
981
|
+
}
|
|
982
|
+
for (const table of classified.tables) {
|
|
983
|
+
total += plannedTables.get(table.pointer)?.length ?? table.rows.length;
|
|
984
|
+
}
|
|
985
|
+
return total;
|
|
986
|
+
}
|
|
987
|
+
function hasAnyConfidence(classified) {
|
|
988
|
+
if (classified.headers.some((header) => header.confidence?.level)) return true;
|
|
989
|
+
if (classified.simpleLists.some((list) => list.items.some((item) => item.confidence?.level))) return true;
|
|
990
|
+
if (classified.entities.some((entity) => entity.items.some(
|
|
991
|
+
(item) => Object.values(item).some((entityCell) => entityCell.confidence?.level)
|
|
992
|
+
))) return true;
|
|
993
|
+
return classified.tables.some((table) => table.rows.some((row) => {
|
|
994
|
+
const meta = row[ROW_META_KEY];
|
|
995
|
+
return Boolean(meta?.confidence?.level);
|
|
996
|
+
}));
|
|
997
|
+
}
|
|
998
|
+
|
|
907
999
|
// src/verification/tip.tsx
|
|
908
1000
|
var import_react = require("react");
|
|
909
1001
|
var import_react_dom = require("react-dom");
|
|
@@ -1917,13 +2009,15 @@ function FieldPair(props) {
|
|
|
1917
2009
|
}
|
|
1918
2010
|
function HeaderSection(props) {
|
|
1919
2011
|
const { headers, simpleLists, shared } = props;
|
|
1920
|
-
|
|
2012
|
+
const visibleHeaders = headers.filter((field) => !shared.hidden.fields.has(field.pointer));
|
|
2013
|
+
const visibleLists = simpleLists.map((list) => ({ ...list, items: list.items.filter((item) => !shared.hidden.fields.has(item.pointer)) })).filter((list) => list.items.length > 0);
|
|
2014
|
+
if (visibleHeaders.length === 0 && visibleLists.length === 0) {
|
|
1921
2015
|
return null;
|
|
1922
2016
|
}
|
|
1923
2017
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "gemina-verification__section", "aria-label": "Details", children: [
|
|
1924
2018
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "gemina-verification__section-header", children: "Details" }),
|
|
1925
2019
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("dl", { className: "gemina-verification__dl", children: [
|
|
1926
|
-
|
|
2020
|
+
visibleHeaders.map((field) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
1927
2021
|
FieldPair,
|
|
1928
2022
|
{
|
|
1929
2023
|
label: formatLabel(field.key),
|
|
@@ -1933,7 +2027,7 @@ function HeaderSection(props) {
|
|
|
1933
2027
|
},
|
|
1934
2028
|
field.pointer
|
|
1935
2029
|
)),
|
|
1936
|
-
|
|
2030
|
+
visibleLists.map((list) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(import_react3.default.Fragment, { children: [
|
|
1937
2031
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dt", { className: "gemina-verification__dt", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("span", { children: formatLabel(list.key) }) }),
|
|
1938
2032
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("dd", { className: "gemina-verification__dd", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("ul", { className: "gemina-verification__list", children: list.items.map((item, index) => {
|
|
1939
2033
|
const binding = shared.bindingIndex.get(item.pointer);
|
|
@@ -1969,16 +2063,19 @@ function HeaderSection(props) {
|
|
|
1969
2063
|
}
|
|
1970
2064
|
function EntitySection(props) {
|
|
1971
2065
|
const { entity, shared } = props;
|
|
2066
|
+
const visibleItems = entity.items.map((item) => Object.fromEntries(
|
|
2067
|
+
Object.entries(item).filter(([, cellValue]) => !shared.hidden.fields.has(cellValue.pointer))
|
|
2068
|
+
)).filter((item) => Object.keys(item).length > 0);
|
|
1972
2069
|
const label = formatLabel(entity.key);
|
|
1973
2070
|
const singular = label.replace(/s$/, "");
|
|
1974
2071
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "gemina-verification__section", "aria-label": label, children: [
|
|
1975
2072
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "gemina-verification__section-header", children: [
|
|
1976
2073
|
label,
|
|
1977
2074
|
" (",
|
|
1978
|
-
|
|
2075
|
+
visibleItems.length,
|
|
1979
2076
|
")"
|
|
1980
2077
|
] }),
|
|
1981
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "gemina-verification__section-body", children:
|
|
2078
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "gemina-verification__section-body", children: visibleItems.map((item, itemIndex) => /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "gemina-verification__card", children: [
|
|
1982
2079
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "gemina-verification__card-header", children: [
|
|
1983
2080
|
singular,
|
|
1984
2081
|
" ",
|
|
@@ -2033,7 +2130,7 @@ function TableRowView(props) {
|
|
|
2033
2130
|
return { classified, binding, editKey: binding?.key.raw };
|
|
2034
2131
|
};
|
|
2035
2132
|
const firstRect = rects.length > 0 ? rects[0] : null;
|
|
2036
|
-
const showControls = planned !== void 0 && tablePointer !== void 0 && !readOnly;
|
|
2133
|
+
const showControls = planned !== void 0 && tablePointer !== void 0 && !readOnly && !shared.filterOn;
|
|
2037
2134
|
const rowLevel = (row?.[ROW_META_KEY]?.confidence?.level ?? "").toLowerCase();
|
|
2038
2135
|
const rowClass = rowLevel === "low" || rowLevel === "medium" ? `gemina-verification__row--${rowLevel}` : void 0;
|
|
2039
2136
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tr", { onClick: handleRowClick, className: rowClass, children: [
|
|
@@ -2082,7 +2179,7 @@ function TableRowView(props) {
|
|
|
2082
2179
|
] });
|
|
2083
2180
|
}
|
|
2084
2181
|
function areRowPropsEqual(prev, next) {
|
|
2085
|
-
if (prev.row !== next.row || prev.rowIndex !== next.rowIndex || prev.columns !== next.columns || prev.tableLabel !== next.tableLabel || prev.hasCoords !== next.hasCoords || prev.hasRowConfidence !== next.hasRowConfidence || prev.planned !== next.planned || prev.tablePointer !== next.tablePointer || prev.shared.bindingIndex !== next.shared.bindingIndex || prev.shared.onEdit !== next.shared.onEdit || prev.shared.onFlash !== next.shared.onFlash || prev.shared.readOnly !== next.shared.readOnly) {
|
|
2182
|
+
if (prev.row !== next.row || prev.rowIndex !== next.rowIndex || prev.columns !== next.columns || prev.tableLabel !== next.tableLabel || prev.hasCoords !== next.hasCoords || prev.hasRowConfidence !== next.hasRowConfidence || prev.planned !== next.planned || prev.tablePointer !== next.tablePointer || prev.shared.bindingIndex !== next.shared.bindingIndex || prev.shared.onEdit !== next.shared.onEdit || prev.shared.onFlash !== next.shared.onFlash || prev.shared.readOnly !== next.shared.readOnly || prev.shared.filterOn !== next.shared.filterOn) {
|
|
2086
2183
|
return false;
|
|
2087
2184
|
}
|
|
2088
2185
|
if (prev.shared.edits === next.shared.edits) {
|
|
@@ -2170,7 +2267,11 @@ function TableSection(props) {
|
|
|
2170
2267
|
}).length,
|
|
2171
2268
|
[table.rows]
|
|
2172
2269
|
);
|
|
2173
|
-
const showControls = planned !== void 0 && mutable !== void 0 && !shared.readOnly;
|
|
2270
|
+
const showControls = planned !== void 0 && mutable !== void 0 && !shared.readOnly && !shared.filterOn;
|
|
2271
|
+
const visiblePlanned = planned?.map((plannedRow, position) => ({ plannedRow, position })).filter(({ plannedRow }) => !shared.hidden.rows.has(plannedRow.entry.id));
|
|
2272
|
+
const visibleRowIndices = planned ? null : table.rows.map((_row, index) => index).filter((index) => !shared.hidden.rows.has(unplannedRowKey(table.pointer, index)));
|
|
2273
|
+
const visibleCount = visiblePlanned ? visiblePlanned.length : visibleRowIndices.length;
|
|
2274
|
+
const allHidden = visibleCount === 0 && rowCount > 0;
|
|
2174
2275
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("section", { className: "gemina-verification__section", "aria-label": label, children: [
|
|
2175
2276
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("div", { className: "gemina-verification__section-header", children: [
|
|
2176
2277
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("span", { children: [
|
|
@@ -2186,7 +2287,11 @@ function TableSection(props) {
|
|
|
2186
2287
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ConfidenceDot, { confidence: table.overallConfidence })
|
|
2187
2288
|
] }) : null
|
|
2188
2289
|
] }),
|
|
2189
|
-
|
|
2290
|
+
allHidden ? /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("p", { className: "gemina-verification__all-scored", children: [
|
|
2291
|
+
"All ",
|
|
2292
|
+
rowCount,
|
|
2293
|
+
" rows scored high"
|
|
2294
|
+
] }) : /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("div", { className: "gemina-verification__table-wrap", children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("table", { className: "gemina-verification__table", children: [
|
|
2190
2295
|
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("thead", { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)("tr", { children: [
|
|
2191
2296
|
hasCoords ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("th", { "aria-label": "Show row on document" }) : null,
|
|
2192
2297
|
hasRowConfidence ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("th", { "aria-label": "Row confidence" }) : null,
|
|
@@ -2199,7 +2304,7 @@ function TableSection(props) {
|
|
|
2199
2304
|
) }, column)),
|
|
2200
2305
|
showControls ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)("th", { "aria-label": "Row actions" }) : null
|
|
2201
2306
|
] }) }),
|
|
2202
|
-
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("tbody", { children:
|
|
2307
|
+
/* @__PURE__ */ (0, import_jsx_runtime3.jsx)("tbody", { children: visiblePlanned ? visiblePlanned.map(({ plannedRow, position }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2203
2308
|
TableRow,
|
|
2204
2309
|
{
|
|
2205
2310
|
row: plannedRow.entry.source === null ? void 0 : table.rows[plannedRow.entry.source],
|
|
@@ -2213,10 +2318,10 @@ function TableSection(props) {
|
|
|
2213
2318
|
tablePointer: mutable.pointer
|
|
2214
2319
|
},
|
|
2215
2320
|
plannedRow.entry.id
|
|
2216
|
-
)) :
|
|
2321
|
+
)) : visibleRowIndices.map((rowIndex) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
2217
2322
|
TableRow,
|
|
2218
2323
|
{
|
|
2219
|
-
row,
|
|
2324
|
+
row: table.rows[rowIndex],
|
|
2220
2325
|
rowIndex,
|
|
2221
2326
|
columns,
|
|
2222
2327
|
tableLabel: label,
|
|
@@ -2287,7 +2392,9 @@ function VerificationForm(props) {
|
|
|
2287
2392
|
rowMutableTables,
|
|
2288
2393
|
plannedTables,
|
|
2289
2394
|
onAddRow,
|
|
2290
|
-
onRemoveRow
|
|
2395
|
+
onRemoveRow,
|
|
2396
|
+
hidden,
|
|
2397
|
+
filterOn
|
|
2291
2398
|
} = props;
|
|
2292
2399
|
const { tables: promotedTables, suppressed } = import_react3.default.useMemo(
|
|
2293
2400
|
() => withEmptyMutableTables(classified, rowMutableTables ?? NO_TABLES),
|
|
@@ -2303,7 +2410,9 @@ function VerificationForm(props) {
|
|
|
2303
2410
|
rowMutableTables: rowMutableTables ?? NO_TABLES,
|
|
2304
2411
|
plannedTables: plannedTables ?? NO_PLANNED,
|
|
2305
2412
|
onAddRow: onAddRow ?? NOOP_ROW,
|
|
2306
|
-
onRemoveRow: onRemoveRow ?? NOOP_ROW
|
|
2413
|
+
onRemoveRow: onRemoveRow ?? NOOP_ROW,
|
|
2414
|
+
hidden: hidden ?? NOTHING_HIDDEN,
|
|
2415
|
+
filterOn: filterOn ?? false
|
|
2307
2416
|
};
|
|
2308
2417
|
return (
|
|
2309
2418
|
// A real, labeled <form> (role "form" landmark): AT users can jump
|
|
@@ -2341,7 +2450,7 @@ function VerificationForm(props) {
|
|
|
2341
2450
|
}
|
|
2342
2451
|
|
|
2343
2452
|
// src/version.ts
|
|
2344
|
-
var VERSION = "0.
|
|
2453
|
+
var VERSION = "0.13.0";
|
|
2345
2454
|
|
|
2346
2455
|
// src/verification/styles.ts
|
|
2347
2456
|
var DARK_VARS = `
|
|
@@ -2874,6 +2983,11 @@ var VERIFICATION_CSS = `
|
|
|
2874
2983
|
}
|
|
2875
2984
|
.gemina-verification__footer {
|
|
2876
2985
|
display: flex;
|
|
2986
|
+
/* Wraps because the review filter adds two more items to this row, and at
|
|
2987
|
+
320 the four together overflow: Submit was pushed 28px past the inline
|
|
2988
|
+
start and clipped. Measured RTL, where the overflow runs the other way
|
|
2989
|
+
and a scrollWidth-minus-clientWidth check on the document never sees it. */
|
|
2990
|
+
flex-wrap: wrap;
|
|
2877
2991
|
align-items: center;
|
|
2878
2992
|
gap: 10px;
|
|
2879
2993
|
padding-block-start: 12px;
|
|
@@ -2890,6 +3004,41 @@ var VERIFICATION_CSS = `
|
|
|
2890
3004
|
cursor: pointer;
|
|
2891
3005
|
}
|
|
2892
3006
|
.gemina-verification__submit:disabled { opacity: 0.5; cursor: default; }
|
|
3007
|
+
/* The review filter is a VIEW MODE, not an action, so it stays quiet: an
|
|
3008
|
+
outline control in the muted color, next to the one loud thing in the
|
|
3009
|
+
footer. Turning it on fills it from the same accent token \u2014 the state has
|
|
3010
|
+
to be unmistakable, because the form is hiding content while it is on. */
|
|
3011
|
+
.gemina-verification__review-filter {
|
|
3012
|
+
font: inherit;
|
|
3013
|
+
font-size: 12px;
|
|
3014
|
+
padding: 4px 12px;
|
|
3015
|
+
border-radius: var(--gemina-verification-radius);
|
|
3016
|
+
border: 1px solid var(--gemina-verification-border);
|
|
3017
|
+
background: transparent;
|
|
3018
|
+
color: var(--gemina-verification-muted);
|
|
3019
|
+
cursor: pointer;
|
|
3020
|
+
}
|
|
3021
|
+
.gemina-verification__review-filter:hover {
|
|
3022
|
+
color: var(--gemina-verification-accent);
|
|
3023
|
+
border-color: var(--gemina-verification-accent);
|
|
3024
|
+
}
|
|
3025
|
+
.gemina-verification__review-filter[aria-checked='true'] {
|
|
3026
|
+
background: var(--gemina-verification-accent);
|
|
3027
|
+
border-color: var(--gemina-verification-accent);
|
|
3028
|
+
color: var(--gemina-verification-accent-fg);
|
|
3029
|
+
}
|
|
3030
|
+
/* Stands in for a table's grid when every row of it scored high. Muted and
|
|
3031
|
+
unemphatic on purpose \u2014 it reports an absence, it is not a finding. */
|
|
3032
|
+
.gemina-verification__filter-count {
|
|
3033
|
+
font-size: 12px;
|
|
3034
|
+
color: var(--gemina-verification-muted);
|
|
3035
|
+
}
|
|
3036
|
+
.gemina-verification__all-scored {
|
|
3037
|
+
margin: 0;
|
|
3038
|
+
padding: 12px;
|
|
3039
|
+
color: var(--gemina-verification-muted);
|
|
3040
|
+
font-size: 13px;
|
|
3041
|
+
}
|
|
2893
3042
|
.gemina-verification__retry {
|
|
2894
3043
|
font: inherit;
|
|
2895
3044
|
font-size: 12px;
|
|
@@ -3247,6 +3396,7 @@ function GeminaVerification(props) {
|
|
|
3247
3396
|
const [imageUrl, setImageUrl] = (0, import_react4.useState)(null);
|
|
3248
3397
|
const [flashRects, setFlashRects] = (0, import_react4.useState)(null);
|
|
3249
3398
|
const [stacked, setStacked] = (0, import_react4.useState)(false);
|
|
3399
|
+
const [filterOn, setFilterOn] = (0, import_react4.useState)(false);
|
|
3250
3400
|
const rootRef = (0, import_react4.useRef)(null);
|
|
3251
3401
|
const mountedRef = (0, import_react4.useRef)(false);
|
|
3252
3402
|
const loadSeqRef = (0, import_react4.useRef)(0);
|
|
@@ -3323,6 +3473,7 @@ function GeminaVerification(props) {
|
|
|
3323
3473
|
rowMutableTables: readRowMutableTables(view.meta.validationFeedback?.rowMutableTables)
|
|
3324
3474
|
});
|
|
3325
3475
|
setEdits(NO_EDITS);
|
|
3476
|
+
setFilterOn(false);
|
|
3326
3477
|
setRowPlans(seedRowPlans(readRowMutableTables(view.meta.validationFeedback?.rowMutableTables), view.values));
|
|
3327
3478
|
const url = view.document.imageUrl;
|
|
3328
3479
|
setImageUrl(typeof url === "string" && url.length > 0 ? url : null);
|
|
@@ -3574,6 +3725,28 @@ function GeminaVerification(props) {
|
|
|
3574
3725
|
});
|
|
3575
3726
|
}, []);
|
|
3576
3727
|
const pairErrors = (0, import_react4.useMemo)(() => unitSizePairErrors(cellViews, edits), [cellViews, edits]);
|
|
3728
|
+
const suppressed = (0, import_react4.useMemo)(
|
|
3729
|
+
() => withEmptyMutableTables(classified, loaded?.rowMutableTables ?? []).suppressed,
|
|
3730
|
+
[classified, loaded?.rowMutableTables]
|
|
3731
|
+
);
|
|
3732
|
+
const canFilter = (0, import_react4.useMemo)(() => hasAnyConfidence(classified), [classified]);
|
|
3733
|
+
const hidden = (0, import_react4.useMemo)(
|
|
3734
|
+
() => filterOn && canFilter ? computeHidden({
|
|
3735
|
+
classified,
|
|
3736
|
+
plannedTables,
|
|
3737
|
+
cellViews,
|
|
3738
|
+
bindingIndex,
|
|
3739
|
+
edits,
|
|
3740
|
+
pairErrors,
|
|
3741
|
+
suppressed
|
|
3742
|
+
}) : NOTHING_HIDDEN,
|
|
3743
|
+
[filterOn, canFilter, classified, plannedTables, cellViews, bindingIndex, edits, pairErrors, suppressed]
|
|
3744
|
+
);
|
|
3745
|
+
const totalUnits = (0, import_react4.useMemo)(
|
|
3746
|
+
() => countUnits(classified, plannedTables, suppressed) + unmatched.length,
|
|
3747
|
+
[classified, plannedTables, suppressed, unmatched]
|
|
3748
|
+
);
|
|
3749
|
+
const visibleUnits = totalUnits - hidden.fields.size - hidden.rows.size;
|
|
3577
3750
|
const invalidCount = (0, import_react4.useMemo)(() => {
|
|
3578
3751
|
const rowLevel = pairErrors.size;
|
|
3579
3752
|
if (edits.size === 0) {
|
|
@@ -3746,6 +3919,8 @@ function GeminaVerification(props) {
|
|
|
3746
3919
|
onFlash: handleFlash,
|
|
3747
3920
|
pairErrors,
|
|
3748
3921
|
rowMutableTables: loaded?.rowMutableTables,
|
|
3922
|
+
hidden,
|
|
3923
|
+
filterOn,
|
|
3749
3924
|
plannedTables,
|
|
3750
3925
|
onAddRow: handleAddRow,
|
|
3751
3926
|
onRemoveRow: handleRemoveRow
|
|
@@ -3774,6 +3949,20 @@ function GeminaVerification(props) {
|
|
|
3774
3949
|
),
|
|
3775
3950
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "gemina-verification__footer", children: [
|
|
3776
3951
|
!alreadyValidated && (invalidCount > 0 ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "gemina-verification__attention", "aria-live": "polite", children: invalidCount === 1 ? "1 field needs attention" : `${invalidCount} fields need attention` }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "gemina-verification__progress", "aria-live": "polite", children: `${submission.confirmed} confirmed \xB7 ${submission.corrected} corrected` })),
|
|
3952
|
+
canFilter && /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_jsx_runtime4.Fragment, { children: [
|
|
3953
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3954
|
+
"button",
|
|
3955
|
+
{
|
|
3956
|
+
type: "button",
|
|
3957
|
+
role: "switch",
|
|
3958
|
+
"aria-checked": filterOn,
|
|
3959
|
+
className: "gemina-verification__review-filter",
|
|
3960
|
+
onClick: () => setFilterOn((on) => !on),
|
|
3961
|
+
children: "Hide high-confidence fields"
|
|
3962
|
+
}
|
|
3963
|
+
),
|
|
3964
|
+
filterOn && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("span", { className: "gemina-verification__filter-count", "aria-live": "polite", children: `Showing ${visibleUnits} of ${totalUnits}` })
|
|
3965
|
+
] }),
|
|
3777
3966
|
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
3778
3967
|
"button",
|
|
3779
3968
|
{
|