hazo_collab_forms 5.1.2 → 5.2.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/CHANGE_LOG.md CHANGED
@@ -7,6 +7,86 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7
7
 
8
8
  ## [Unreleased]
9
9
 
10
+ ## [5.2.0] - 2026-05-04
11
+
12
+ ### Added
13
+
14
+ - **`ExpectedField.array_of`** — declare a field whose value is an array of
15
+ structured rows, e.g. `array_of: { type: 'object', shape: [...] }`. The
16
+ classification prompt builder auto-emits an `(array of objects)` sub-block
17
+ with the nested shape, and `ExtractedFieldsInline` renders the value as
18
+ a table with one column per shape entry. Backwards-compatible (optional).
19
+ - **`ThreadFormProps.on_request_reextraction`** — agent-only per-file
20
+ re-extract callback. Signature `(content_id, scope: 'classification' | 'full')
21
+ => Promise<void> | void`. Wired through `ThreadForm` →
22
+ `CollectedDataView` → `ExtractedFieldsInline`.
23
+ - **Re-extract icon button** on the extracted-fields meta line, plus a
24
+ Radix Popover **kebab menu** with two scopes (`'classification'` / `'full'`).
25
+ Visible only when `role === 'agent'` AND a callback is provided.
26
+ - **Dim-in-place loading state** for the re-extract action. Content area
27
+ gets `opacity-50 pointer-events-none` while the callback is in flight;
28
+ action buttons stay clickable (visibly disabled).
29
+ - **Per-row accordion** in `CollectedDataView`. Each file row's extracted-
30
+ fields block collapses behind a chevron; default state is collapsed.
31
+ - **Expand all / Collapse all** toggle in the Collected Data tab header.
32
+ Single button that flips based on current state.
33
+ - **Info icon (`FileInfoDialog`) on Collected Data file rows** — agent-only
34
+ trigger that opens the same classification + validation + debug-JSON
35
+ dialog already present on `FileBar`. Hidden when there's nothing to
36
+ show.
37
+ - **`build_extracted_fields_instruction`** helper exposed via
38
+ `__test_only__` for unit testing the prompt-builder path.
39
+ - Renderer now handles **lenient fallbacks** for arrays:
40
+ - Undeclared `Array<object>` → inferred-column table
41
+ - Undeclared `Array<scalar>` → bullet list
42
+ - Declared scalar with `Array<object>` value → inferred-column table
43
+ (uses declared label) — schema upgrade hint without breaking
44
+ - **Test-app demo** (`/thread-form-extracted-fields`) updated with
45
+ rental-statement fixture exercising every render path, plus a mock
46
+ re-extract handler that swaps state after a 1.2s delay.
47
+
48
+ ### Changed
49
+
50
+ - **`render_document_types`** factored into a recursive `render_expected_field`
51
+ helper that emits the nested object-array sub-block. Pure refactor;
52
+ scalar output unchanged.
53
+ - **`extracted_fields_instruction`** assembly extracted into the pure
54
+ `build_extracted_fields_instruction(document_types)` helper, replacing
55
+ the inline construction in the route handler. Adds an `array_of`-aware
56
+ clause when at least one doctype declares it.
57
+ - **`ExtractedFieldsInline`** restructured around a `partition_entries`
58
+ helper that splits entries into scalars / tables / lists. JSX now
59
+ uses semantic `<table>`/`<thead>`/`<tbody>` with `border-collapse`,
60
+ `scope="col"` on `<th>`, `<caption className="sr-only">`, alternating
61
+ row tint, and `tabular-nums` on numeric/currency columns. Bordered
62
+ card wrapper around each table.
63
+ - **Internal `has_anything` → `has_content`** rename in
64
+ `ExtractedFieldsInline` so the existing "confidence alone returns null"
65
+ contract remains pinned even with the new content categories.
66
+
67
+ ### Fixed
68
+
69
+ - **`parse_classification_response` no longer JSON-stringifies arrays
70
+ in `extracted_fields` extras.** Previously, declared `array_of: object`
71
+ values arrived at the client as JSON-encoded strings (because
72
+ `JSON.stringify(v)` ran on every `typeof v === 'object'` value),
73
+ silently breaking the table render path. Arrays now pass through
74
+ unchanged; plain (non-array) objects still get stringified for the
75
+ scalar fallback.
76
+ - **Re-extract click in tests** wrapped in `await act(async () => ...)`
77
+ to flush the trailing `set_is_loading(false)` state update.
78
+
79
+ ### Notes
80
+
81
+ - All schema/prop additions are optional — no consumer change required to
82
+ upgrade. To take advantage of `array_of` table rendering, opt in by
83
+ adding `array_of: { type: 'object', shape: [...] }` to your doctype's
84
+ `expected_fields`.
85
+ - The `LuMoreVertical` icon was substituted with `LuEllipsisVertical`
86
+ (lucide-react renamed it upstream); visually identical.
87
+ - Internal: 31 tests in `extracted_fields_inline.test.tsx` cover every
88
+ branch of the partition decision tree plus the loading-state lifecycle.
89
+
10
90
  ## [5.1.0] - 2026-05-03
11
91
 
12
92
  ### Added
package/README.md CHANGED
@@ -2848,7 +2848,10 @@ const fileManager: FileManagerConfig = {
2848
2848
 
2849
2849
  `<ThreadForm>` and `<CollectedDataView>` can display each file's
2850
2850
  `classification_result.extracted_fields` inline below its row in the
2851
- Collected Data tab.
2851
+ Collected Data tab. As of v5.2.0 the display supports scalar fields,
2852
+ **repeating-row tables** (declared via `array_of`), and bullet lists
2853
+ for scalar arrays — plus a per-row accordion, an info-icon dialog,
2854
+ and an agent-only re-extract action.
2852
2855
 
2853
2856
  ```tsx
2854
2857
  <ThreadForm
@@ -2858,6 +2861,10 @@ Collected Data tab.
2858
2861
  show_extracted_fields
2859
2862
  collected_data_locale="en-AU"
2860
2863
  collected_data_currency_code="AUD"
2864
+ on_request_reextraction={async (content_id, scope) => {
2865
+ // 'classification' = re-run classify only; 'full' = + back-office
2866
+ await my_api.reclassify(content_id, scope);
2867
+ }}
2861
2868
  available_document_types={[
2862
2869
  {
2863
2870
  type_id: 'bank_statement',
@@ -2867,16 +2874,90 @@ Collected Data tab.
2867
2874
  { key: 'interest_earned', type: 'currency', description: 'Total interest' },
2868
2875
  ],
2869
2876
  },
2877
+ {
2878
+ type_id: 'rental_statement',
2879
+ type_label: 'Rental Statement',
2880
+ expected_fields: [
2881
+ { key: 'vendor', type: 'string', label: 'Vendor' },
2882
+ { key: 'property_address', type: 'string', label: 'Property address' },
2883
+ { key: 'total', type: 'currency', label: 'Total' },
2884
+ {
2885
+ // Object-array shape → renders as a table with one column per shape entry
2886
+ key: 'line_items',
2887
+ label: 'Line items',
2888
+ array_of: {
2889
+ type: 'object',
2890
+ shape: [
2891
+ { key: 'description', type: 'string', label: 'Description' },
2892
+ { key: 'type', type: 'string', label: 'Type' },
2893
+ { key: 'amount', type: 'currency', label: 'Amount' },
2894
+ ],
2895
+ },
2896
+ },
2897
+ ],
2898
+ },
2870
2899
  ]}
2871
2900
  />
2872
2901
  ```
2873
2902
 
2874
- If your consuming app already passes `available_document_types` from a
2875
- config table (e.g. `hazo_app_config.classification_document_types`), the
2876
- existing prop pickup needs no other change just add `expected_fields`
2877
- to the rows you want to drive the inline display.
2903
+ ### Render decision tree (per `extracted_fields` key)
2904
+
2905
+ | Field declaration | Value shape | Renders as |
2906
+ |---|---|---|
2907
+ | `array_of: { type: 'object', shape }` | `Array<object>` | **Table** with declared columns |
2908
+ | `array_of: { type: 'object', shape }` | empty array `[]` | Dropped (entry hidden) |
2909
+ | `array_of: { type: 'object', shape }` | non-array (string, number, single object) | JSON-string scalar (strict mismatch — surface the bug) |
2910
+ | Plain `type: 'string' \| 'number' \| 'currency' \| 'date' \| 'boolean'` | `Array<object>` | **Table** with inferred columns (lenient — uses declared label) |
2911
+ | Plain `type` | `Array<scalar>` | **Bullet list** (lenient) |
2912
+ | Plain `type` | scalar | Inline dot-list entry |
2913
+ | Undeclared (LLM-emitted extra) | `Array<object>` | **Table** with inferred columns |
2914
+ | Undeclared | `Array<scalar>` | **Bullet list** |
2915
+ | Undeclared | scalar | Inline dot-list entry |
2916
+
2917
+ Strict-for-declared-`array_of` semantics surface schema mismatches as
2918
+ readable JSON so they're noticed; everything else degrades gracefully
2919
+ into the most useful display.
2920
+
2921
+ ### Per-row accordion + Expand/Collapse all
2922
+
2923
+ Each file row's extracted-fields block is collapsed by default. A
2924
+ chevron between the checkbox and the file icon toggles that row.
2925
+ The header bar above the categories shows a single button that
2926
+ flips between **Expand all** and **Collapse all** based on current
2927
+ state. No prop required — it's on by default.
2928
+
2929
+ ### File info dialog (agent-only)
2930
+
2931
+ Each agent-side file row in the Collected Data tab has an `(i)`
2932
+ icon next to "View" that opens `FileInfoDialog` showing the
2933
+ classification result, validation rule outcomes, and debug JSON.
2934
+ Same component as the one on `FileBar`. Hidden when the row has
2935
+ no classification AND no validation results.
2936
+
2937
+ ### Re-extract action (agent-only)
2938
+
2939
+ When `on_request_reextraction` is provided AND `role === 'agent'`,
2940
+ `ExtractedFieldsInline` renders a refresh icon on the meta line plus
2941
+ a kebab popover with two scopes:
2942
+
2943
+ - **Re-extract fields** (or click the icon): scope `'classification'`
2944
+ — re-run the classify-document LLM call.
2945
+ - **Re-run full analysis**: scope `'full'` — consumer-defined; typically
2946
+ re-classify and re-run back-office validation.
2947
+
2948
+ While the callback is in flight, the content dims (`opacity-50
2949
+ pointer-events-none`) and the icon spins. The buttons stay clickable
2950
+ (visibly disabled). Concurrent re-extracts on different files are fine;
2951
+ re-clicking the same row is a no-op until the callback resolves.
2952
+
2953
+ The consumer is expected to call `on_update_content_item(content_id,
2954
+ { classification_result })` once their API returns; the renderer
2955
+ re-renders automatically.
2956
+
2957
+ ### Custom layout escape hatch
2878
2958
 
2879
- For fully custom layouts use `render_collected_item_details`:
2959
+ For fully custom layouts use `render_collected_item_details` (takes
2960
+ precedence over `show_extracted_fields`):
2880
2961
 
2881
2962
  ```tsx
2882
2963
  <ThreadForm
@@ -2888,10 +2969,24 @@ For fully custom layouts use `render_collected_item_details`:
2888
2969
  ### Prompt variable: `{{extracted_fields_instruction}}`
2889
2970
 
2890
2971
  `create_classification_route` resolves `{{extracted_fields_instruction}}`
2891
- to either a targeted instruction (when any doctype declares
2892
- `expected_fields`) or a generic fallback. Add this variable to your
2893
- classification prompt template to opt in. Existing prompts that don't
2894
- reference it keep working unchanged.
2972
+ to one of three strings depending on what's declared in
2973
+ `available_document_types`:
2974
+
2975
+ - **No doctype declares `expected_fields`** → generic fallback
2976
+ (`"Return any fields you would consider salient..."`).
2977
+ - **At least one doctype declares `expected_fields`** → targeted
2978
+ instruction (`"Return the listed expected_fields for the chosen
2979
+ doctype above..."`).
2980
+ - **At least one doctype declares `array_of`** → targeted instruction
2981
+ PLUS array clause (`"...For fields marked 'array of objects', return
2982
+ a JSON array where each element is an object with the listed keys."`).
2983
+
2984
+ The doctype block in the prompt also auto-emits a nested shape
2985
+ sub-block for `array_of` fields so the LLM knows the expected JSON
2986
+ structure.
2987
+
2988
+ Existing prompts that don't reference `{{extracted_fields_instruction}}`
2989
+ keep working unchanged.
2895
2990
 
2896
2991
  ---
2897
2992
 
@@ -25,6 +25,10 @@ export interface CollectedDataViewProps {
25
25
  locale?: string;
26
26
  currency_code?: string;
27
27
  truncate_chars?: number;
28
+ /** Role gating for action buttons in inline display. */
29
+ role?: 'agent' | 'client';
30
+ /** Per-file re-extract callback. See ThreadFormProps for full docs. */
31
+ on_request_reextraction?: (content_id: string, scope: 'classification' | 'full') => Promise<void> | void;
28
32
  }
29
- export declare function CollectedDataView({ data, classification_results, on_selection_change, on_export, on_view_file, render_item_details, show_extracted_fields, document_types, locale, currency_code, truncate_chars, }: CollectedDataViewProps): import("react/jsx-runtime").JSX.Element;
33
+ export declare function CollectedDataView({ data, classification_results, on_selection_change, on_export, on_view_file, render_item_details, show_extracted_fields, document_types, locale, currency_code, truncate_chars, role, on_request_reextraction, }: CollectedDataViewProps): import("react/jsx-runtime").JSX.Element;
30
34
  //# sourceMappingURL=collected_data_view.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"collected_data_view.d.ts","sourceRoot":"","sources":["../../../../src/components/thread_form/components/collected_data_view.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAIH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAIjH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,cAAc,CAAC;IACrB,sBAAsB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAC3D,mBAAmB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpE,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;IAC9C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C;;;OAGG;IACH,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,KAAK,CAAC,SAAS,CAAC;IAC7D;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,0FAA0F;IAC1F,cAAc,CAAC,EAAE,0BAA0B,EAAE,CAAC;IAC9C,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAoFD,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,sBAAsB,EACtB,mBAAmB,EACnB,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,MAAM,EACN,aAAa,EACb,cAAc,GACf,EAAE,sBAAsB,2CA4HxB"}
1
+ {"version":3,"file":"collected_data_view.d.ts","sourceRoot":"","sources":["../../../../src/components/thread_form/components/collected_data_view.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,OAAO,KAAK,EAAE,cAAc,EAAE,WAAW,EAAE,oBAAoB,EAAE,0BAA0B,EAAE,MAAM,aAAa,CAAC;AA6CjH,MAAM,WAAW,sBAAsB;IACrC,IAAI,EAAE,cAAc,CAAC;IACrB,sBAAsB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAC3D,mBAAmB,CAAC,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,IAAI,CAAC;IACpE,SAAS,CAAC,EAAE,CAAC,QAAQ,EAAE,WAAW,EAAE,KAAK,IAAI,CAAC;IAC9C,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAAC;IAC3C;;;OAGG;IACH,mBAAmB,CAAC,EAAE,CAAC,IAAI,EAAE,WAAW,KAAK,KAAK,CAAC,SAAS,CAAC;IAC7D;;;OAGG;IACH,qBAAqB,CAAC,EAAE,OAAO,CAAC;IAChC,0FAA0F;IAC1F,cAAc,CAAC,EAAE,0BAA0B,EAAE,CAAC;IAC9C,+CAA+C;IAC/C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wDAAwD;IACxD,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,uEAAuE;IACvE,uBAAuB,CAAC,EAAE,CACxB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,gBAAgB,GAAG,MAAM,KAC7B,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC3B;AAoFD,wBAAgB,iBAAiB,CAAC,EAChC,IAAI,EACJ,sBAAsB,EACtB,mBAAmB,EACnB,SAAS,EACT,YAAY,EACZ,mBAAmB,EACnB,qBAAqB,EACrB,cAAc,EACd,MAAM,EACN,aAAa,EACb,cAAc,EACd,IAAI,EACJ,uBAAuB,GACxB,EAAE,sBAAsB,2CA8KxB"}
@@ -3,9 +3,25 @@
3
3
  * Checkboxes for selecting what to export. AI auto-checks relevant items.
4
4
  */
5
5
  'use client';
6
- import { jsxs as _jsxs, jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
6
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
7
+ import { useState } from 'react';
7
8
  import { ExtractedFieldsInline } from './extracted_fields_inline.js';
9
+ import { FileInfoDialog } from './file_info_dialog.js';
8
10
  import { PdfIcon } from './shared.js';
11
+ /** Inline info-icon button that opens FileInfoDialog. Agent-only by default. */
12
+ function FileInfoButton({ item, classification_results, }) {
13
+ const [open, set_open] = useState(false);
14
+ if (item.type !== 'file' || !item.file)
15
+ return null;
16
+ const classification = item.classification_result
17
+ ?? classification_results?.get(item.content_id)
18
+ ?? null;
19
+ const validation_results = item.validation_rule_results ?? [];
20
+ const has_info = !!classification || validation_results.length > 0;
21
+ if (!has_info)
22
+ return null;
23
+ return (_jsxs(_Fragment, { children: [_jsx("button", { type: "button", onClick: () => set_open(true), className: "p-0.5 rounded text-[#94A3B8] hover:text-blue-500 transition-colors flex-shrink-0 cursor-pointer", title: "File details", children: _jsx("svg", { className: "w-3.5 h-3.5", fill: "currentColor", viewBox: "0 0 20 20", children: _jsx("path", { fillRule: "evenodd", d: "M18 10a8 8 0 11-16 0 8 8 0 0116 0zm-7-4a1 1 0 11-2 0 1 1 0 012 0zM9 9a1 1 0 000 2v3a1 1 0 001 1h1a1 1 0 100-2v-3a1 1 0 00-1-1H9z", clipRule: "evenodd" }) }) }), _jsx(FileInfoDialog, { open: open, on_open_change: set_open, file_name: item.file.file_name, classification: classification, validation_results: validation_results })] }));
24
+ }
9
25
  /** Gather all content items across tasks, grouped by category */
10
26
  function gather_categories(data, classification_results) {
11
27
  const categories = new Map();
@@ -88,13 +104,29 @@ function is_item_selected(item, selections) {
88
104
  const explicit = selections[item.content_id];
89
105
  return explicit === undefined ? default_selected(item) : explicit;
90
106
  }
91
- export function CollectedDataView({ data, classification_results, on_selection_change, on_export, on_view_file, render_item_details, show_extracted_fields, document_types, locale, currency_code, truncate_chars, }) {
107
+ export function CollectedDataView({ data, classification_results, on_selection_change, on_export, on_view_file, render_item_details, show_extracted_fields, document_types, locale, currency_code, truncate_chars, role, on_request_reextraction, }) {
92
108
  const categories = gather_categories(data, classification_results);
93
109
  const selections = data.collected_data_selections || {};
110
+ // Per-row accordion state. Default: all collapsed. Set membership = expanded.
111
+ const [expanded_rows, set_expanded_rows] = useState(new Set());
94
112
  const handle_toggle = (item) => {
95
113
  const current = is_item_selected(item, selections);
96
114
  on_selection_change?.({ [item.content_id]: !current });
97
115
  };
116
+ const toggle_row = (content_id) => {
117
+ set_expanded_rows(prev => {
118
+ const next = new Set(prev);
119
+ if (next.has(content_id))
120
+ next.delete(content_id);
121
+ else
122
+ next.add(content_id);
123
+ return next;
124
+ });
125
+ };
126
+ const all_content_ids = Array.from(categories.values()).flat().map(i => i.content_id);
127
+ const expand_all = () => set_expanded_rows(new Set(all_content_ids));
128
+ const collapse_all = () => set_expanded_rows(new Set());
129
+ const all_expanded = expanded_rows.size > 0 && expanded_rows.size === all_content_ids.length;
98
130
  const handle_export = () => {
99
131
  const selected = [];
100
132
  for (const [, items] of categories) {
@@ -109,7 +141,7 @@ export function CollectedDataView({ data, classification_results, on_selection_c
109
141
  .flat()
110
142
  .filter(item => is_item_selected(item, selections)).length;
111
143
  const total_items = Array.from(categories.values()).flat().length;
112
- return (_jsxs("div", { className: "space-y-4", children: [_jsx("div", { className: "flex items-center justify-between text-[13px] text-[#64748B]", children: _jsxs("span", { children: [total_selected, " of ", total_items, " items selected"] }) }), Array.from(categories.entries()).map(([cat, items]) => {
144
+ return (_jsxs("div", { className: "space-y-4", children: [_jsxs("div", { className: "flex items-center justify-between text-[13px] text-[#64748B]", children: [_jsxs("span", { children: [total_selected, " of ", total_items, " items selected"] }), _jsx("button", { type: "button", onClick: all_expanded ? collapse_all : expand_all, className: "text-[12px] text-[#2563EB] hover:text-[#1D4ED8] font-medium cursor-pointer", children: all_expanded ? 'Collapse all' : 'Expand all' })] }), Array.from(categories.entries()).map(([cat, items]) => {
113
145
  const sel_count = items.filter(i => is_item_selected(i, selections)).length;
114
146
  const sorted = sort_with_replacement_chains(items);
115
147
  return (_jsxs("div", { className: "rounded-md border border-[#E2E8F0] overflow-hidden", children: [_jsxs("div", { className: "flex items-center justify-between px-4 py-2.5 bg-[#F8FAFC] border-b border-[#E2E8F0]", children: [_jsx("span", { className: "text-[13px] font-medium text-[#0F172A]", children: cat }), _jsxs("span", { className: "text-[11px] text-[#94A3B8]", children: [sel_count, "/", items.length, " selected"] })] }), _jsx("div", { className: "divide-y divide-[#F1F5F9]", children: sorted.map(({ item, depth }) => {
@@ -118,9 +150,11 @@ export function CollectedDataView({ data, classification_results, on_selection_c
118
150
  const inline_details = render_item_details
119
151
  ? render_item_details(item)
120
152
  : show_extracted_fields
121
- ? _jsx(ExtractedFieldsInline, { item: item, classification_results: classification_results, document_types: document_types, locale: locale, currency_code: currency_code, truncate_chars: truncate_chars })
153
+ ? _jsx(ExtractedFieldsInline, { item: item, classification_results: classification_results, document_types: document_types, locale: locale, currency_code: currency_code, truncate_chars: truncate_chars, role: role, on_request_reextraction: on_request_reextraction })
122
154
  : null;
123
- return (_jsxs("div", { children: [_jsxs("div", { className: `flex items-center gap-3 px-4 py-2.5 text-[13px] hover:bg-[#FAFBFC] ${is_replaced ? 'bg-[#F8FAFC]' : ''}`, style: depth > 0 ? { paddingLeft: `${16 + depth * 20}px` } : undefined, children: [_jsx("input", { type: "checkbox", checked: is_selected, onChange: () => handle_toggle(item), className: "rounded border-[#CBD5E1] text-[#2563EB] focus:ring-[#2563EB] cursor-pointer" }), item.type === 'file' ? (_jsxs(_Fragment, { children: [_jsx(PdfIcon, { className: `w-4 h-4 ${is_replaced ? 'opacity-40' : ''}` }), _jsx("span", { className: `truncate flex-1 ${is_replaced ? 'text-[#94A3B8] line-through' : 'text-[#0F172A]'}`, children: item.file?.file_name || item.split_info?.label }), item.split_info?.page_range && (_jsx("span", { className: "text-[11px] text-[#94A3B8]", children: item.split_info.page_range })), is_replaced && (_jsx("span", { className: "text-[10px] text-[#94A3B8] uppercase tracking-wide flex-shrink-0", children: "Replaced" })), _jsx("button", { onClick: () => on_view_file?.(item), className: "text-[11px] text-[#2563EB] font-medium cursor-pointer", children: "View" })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: `flex-shrink-0 ${is_replaced ? 'text-[#CBD5E1]' : 'text-[#94A3B8]'}`, children: _jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) }) }), _jsx("span", { className: `truncate flex-1 ${is_replaced ? 'text-[#94A3B8] line-through' : 'text-[#0F172A]'}`, children: item.text }), is_replaced && (_jsx("span", { className: "text-[10px] text-[#94A3B8] uppercase tracking-wide flex-shrink-0", children: "Replaced" }))] }))] }), inline_details && (_jsx("div", { className: `px-4 pb-2 text-[13px] ${is_replaced ? 'bg-[#F8FAFC]' : ''}`, style: depth > 0 ? { paddingLeft: `${16 + depth * 20}px` } : undefined, children: inline_details }))] }, item.content_id));
155
+ const has_details = !!inline_details;
156
+ const is_expanded = expanded_rows.has(item.content_id);
157
+ return (_jsxs("div", { children: [_jsxs("div", { className: `flex items-center gap-3 px-4 py-2.5 text-[13px] hover:bg-[#FAFBFC] ${is_replaced ? 'bg-[#F8FAFC]' : ''}`, style: depth > 0 ? { paddingLeft: `${16 + depth * 20}px` } : undefined, children: [_jsx("input", { type: "checkbox", checked: is_selected, onChange: () => handle_toggle(item), className: "rounded border-[#CBD5E1] text-[#2563EB] focus:ring-[#2563EB] cursor-pointer" }), has_details ? (_jsx("button", { type: "button", onClick: () => toggle_row(item.content_id), "aria-expanded": is_expanded, "aria-label": is_expanded ? 'Collapse details' : 'Expand details', className: "p-0.5 rounded text-[#94A3B8] hover:text-[#475569] transition-colors flex-shrink-0 cursor-pointer", children: _jsx("svg", { className: `w-3.5 h-3.5 transition-transform ${is_expanded ? 'rotate-90' : ''}`, fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 2, d: "M9 5l7 7-7 7" }) }) })) : (_jsx("span", { className: "w-3.5 flex-shrink-0", "aria-hidden": "true" })), item.type === 'file' ? (_jsxs(_Fragment, { children: [_jsx(PdfIcon, { className: `w-4 h-4 ${is_replaced ? 'opacity-40' : ''}` }), _jsx("span", { className: `truncate flex-1 ${is_replaced ? 'text-[#94A3B8] line-through' : 'text-[#0F172A]'}`, children: item.file?.file_name || item.split_info?.label }), item.split_info?.page_range && (_jsx("span", { className: "text-[11px] text-[#94A3B8]", children: item.split_info.page_range })), is_replaced && (_jsx("span", { className: "text-[10px] text-[#94A3B8] uppercase tracking-wide flex-shrink-0", children: "Replaced" })), role === 'agent' && (_jsx(FileInfoButton, { item: item, classification_results: classification_results })), _jsx("button", { onClick: () => on_view_file?.(item), className: "text-[11px] text-[#2563EB] font-medium cursor-pointer", children: "View" })] })) : (_jsxs(_Fragment, { children: [_jsx("span", { className: `flex-shrink-0 ${is_replaced ? 'text-[#CBD5E1]' : 'text-[#94A3B8]'}`, children: _jsx("svg", { className: "w-4 h-4", fill: "none", stroke: "currentColor", viewBox: "0 0 24 24", children: _jsx("path", { strokeLinecap: "round", strokeLinejoin: "round", strokeWidth: 1.5, d: "M9 12h6m-6 4h6m2 5H7a2 2 0 01-2-2V5a2 2 0 012-2h5.586a1 1 0 01.707.293l5.414 5.414a1 1 0 01.293.707V19a2 2 0 01-2 2z" }) }) }), _jsx("span", { className: `truncate flex-1 ${is_replaced ? 'text-[#94A3B8] line-through' : 'text-[#0F172A]'}`, children: item.text }), is_replaced && (_jsx("span", { className: "text-[10px] text-[#94A3B8] uppercase tracking-wide flex-shrink-0", children: "Replaced" }))] }))] }), has_details && is_expanded && (_jsx("div", { className: `px-4 pb-2 text-[13px] ${is_replaced ? 'bg-[#F8FAFC]' : ''}`, style: depth > 0 ? { paddingLeft: `${16 + depth * 20}px` } : undefined, children: inline_details }))] }, item.content_id));
124
158
  }) })] }, cat));
125
159
  }), _jsxs("button", { onClick: handle_export, disabled: total_selected === 0, className: "w-full bg-[#0F172A] text-white rounded-md py-2.5 text-[13px] font-medium hover:bg-[#1E293B] disabled:bg-[#E2E8F0] disabled:text-[#94A3B8] cursor-pointer disabled:cursor-not-allowed transition-colors", children: ["Export ", total_selected, " Selected Items to Data Form \u2192"] })] }));
126
160
  }
@@ -1 +1 @@
1
- {"version":3,"file":"collected_data_view.js","sourceRoot":"","sources":["../../../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AACJ,CAAC"}
1
+ {"version":3,"file":"collected_data_view.js","sourceRoot":"","sources":["../../../../src/components/thread_form/components/collected_data_view.tsx"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,YAAY,CAAC;;AAEb,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAGjC,OAAO,EAAE,qBAAqB,EAAE,MAAM,8BAA8B,CAAC;AACrE,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAEtC,gFAAgF;AAChF,SAAS,cAAc,CAAC,EACtB,IAAI,EACJ,sBAAsB,GAIvB;IACC,MAAM,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACzC,IAAI,IAAI,CAAC,IAAI,KAAK,MAAM,IAAI,CAAC,IAAI,CAAC,IAAI;QAAE,OAAO,IAAI,CAAC;IACpD,MAAM,cAAc,GAAG,IAAI,CAAC,qBAAqB;WAC5C,sBAAsB,EAAE,GAAG,CAAC,IAAI,CAAC,UAAU,CAAC;WAC5C,IAAI,CAAC;IACV,MAAM,kBAAkB,GAAI,IAAI,CAAC,uBAA8D,IAAI,EAAE,CAAC;IACtG,MAAM,QAAQ,GAAG,CAAC,CAAC,cAAc,IAAI,kBAAkB,CAAC,MAAM,GAAG,CAAC,CAAC;IACnE,IAAI,CAAC,QAAQ;QAAE,OAAO,IAAI,CAAC;IAC3B,OAAO,CACL,8BACE,iBACE,IAAI,EAAC,QAAQ,EACb,OAAO,EAAE,GAAG,EAAE,CAAC,QAAQ,CAAC,IAAI,CAAC,EAC7B,SAAS,EAAC,iGAAiG,EAC3G,KAAK,EAAC,cAAc,YAEpB,cAAK,SAAS,EAAC,aAAa,EAAC,IAAI,EAAC,cAAc,EAAC,OAAO,EAAC,WAAW,YAClE,eAAM,QAAQ,EAAC,SAAS,EAAC,CAAC,EAAC,kIAAkI,EAAC,QAAQ,EAAC,SA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AO,EAAC,WAAW,YAAC,eAAM,aAAa,EAAC,OAAO,EAAC,cAAc,EAAC,OAAO,EAAC,WAAW,EAAE,GAAG,EAAE,CAAC,EAAC,sHAAsH,GAAG,GAAM,GAChR,EACP,eAAM,SAAS,EAAE,mBAAmB,WAAW,CAAC,CAAC,CAAC,6BAA6B,CAAC,CAAC,CAAC,gBAAgB,EAAE,YAAG,IAAI,CAAC,IAAI,GAAQ,EACvH,WAAW,IAAI,CACd,eAAM,SAAS,EAAC,kEAAkE,yBAAgB,CACnG,IACA,CACJ,IACG,EACL,WAAW,IAAI,WAAW,IAAI,CAC7B,cACE,SAAS,EAAE,yBAAyB,WAAW,CAAC,CAAC,CAAC,cAAc,CAAC,CAAC,CAAC,EAAE,EAAE,EACvE,KAAK,EAAE,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,EAAE,WAAW,EAAE,GAAG,EAAE,GAAG,KAAK,GAAG,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,SAAS,YAErE,cAAc,GACX,CACP,KApEO,IAAI,CAAC,UAAU,CAqEnB,CACP,CAAC;4BACJ,CAAC,CAAC,GACE,KAlGE,GAAG,CAmGP,CACP,CAAC;YACJ,CAAC,CAAC,EAGF,kBACE,OAAO,EAAE,aAAa,EACtB,QAAQ,EAAE,cAAc,KAAK,CAAC,EAC9B,SAAS,EAAC,wMAAwM,wBAE1M,cAAc,2CACf,IACL,CACP,CAAC;AACJ,CAAC"}
@@ -7,6 +7,10 @@ export interface ExtractedFieldsInlineProps {
7
7
  locale?: string;
8
8
  currency_code?: string;
9
9
  truncate_chars?: number;
10
+ /** When 'agent' AND on_request_reextraction provided, renders the re-extract action. */
11
+ role?: 'agent' | 'client';
12
+ /** Per-file re-extract callback. See ThreadFormProps for full docs. */
13
+ on_request_reextraction?: (content_id: string, scope: 'classification' | 'full') => Promise<void> | void;
10
14
  }
11
15
  export declare function ExtractedFieldsInline(props: ExtractedFieldsInlineProps): React.ReactElement | null;
12
16
  //# sourceMappingURL=extracted_fields_inline.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"extracted_fields_inline.d.ts","sourceRoot":"","sources":["../../../../src/components/thread_form/components/extracted_fields_inline.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAiB,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAIhH,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,WAAW,CAAC;IAClB,sBAAsB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAC3D,cAAc,CAAC,EAAE,0BAA0B,EAAE,CAAC;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAgBD,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CAkElG"}
1
+ {"version":3,"file":"extracted_fields_inline.d.ts","sourceRoot":"","sources":["../../../../src/components/thread_form/components/extracted_fields_inline.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,EAAE,WAAW,EAAE,oBAAoB,EAAoC,0BAA0B,EAAE,MAAM,aAAa,CAAC;AAMnI,MAAM,WAAW,0BAA0B;IACzC,IAAI,EAAE,WAAW,CAAC;IAClB,sBAAsB,CAAC,EAAE,GAAG,CAAC,MAAM,EAAE,oBAAoB,CAAC,CAAC;IAC3D,cAAc,CAAC,EAAE,0BAA0B,EAAE,CAAC;IAC9C,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,wFAAwF;IACxF,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,CAAC;IAC1B,uEAAuE;IACvE,uBAAuB,CAAC,EAAE,CACxB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,gBAAgB,GAAG,MAAM,KAC7B,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI,CAAC;CAC3B;AA6ID,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,KAAK,CAAC,YAAY,GAAG,IAAI,CA6MlG"}
@@ -1,5 +1,8 @@
1
1
  'use client';
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import * as React from 'react';
4
+ import * as PopoverPrimitive from '@radix-ui/react-popover';
5
+ import { LuRefreshCw, LuEllipsisVertical } from 'react-icons/lu';
3
6
  import { format_extracted_field, prettify_key } from '../utils/format_extracted_field.js';
4
7
  function resolve_classification(item, classification_results) {
5
8
  return item.classification_result ?? classification_results?.get(item.content_id);
@@ -9,8 +12,95 @@ function get_renderable_entries(fields) {
9
12
  return [];
10
13
  return Object.entries(fields).filter(([, v]) => v !== null && v !== undefined && v !== '');
11
14
  }
15
+ function is_plain_object(v) {
16
+ return typeof v === 'object' && v !== null && !Array.isArray(v);
17
+ }
18
+ function is_array_of_objects(v) {
19
+ return Array.isArray(v) && v.length > 0 && v.every(is_plain_object);
20
+ }
21
+ function is_array_of_scalars(v) {
22
+ return Array.isArray(v) && v.length > 0 && v.every(el => el === null || ['string', 'number', 'boolean'].includes(typeof el));
23
+ }
24
+ function partition_entries(entries, field_index) {
25
+ const scalars = [];
26
+ const tables = [];
27
+ const lists = [];
28
+ for (const [k, v] of entries) {
29
+ const hint = field_index.get(k);
30
+ // Path 1: declared array_of object
31
+ if (hint?.array_of && hint.array_of.type === 'object') {
32
+ if (Array.isArray(v) && v.length === 0) {
33
+ // Empty array → drop entirely
34
+ continue;
35
+ }
36
+ if (is_array_of_objects(v)) {
37
+ const columns = hint.array_of.shape.map(s => ({
38
+ key: s.key,
39
+ label: s.label ?? prettify_key(s.key),
40
+ type: s.type,
41
+ }));
42
+ tables.push({
43
+ key: k,
44
+ label: hint.label ?? prettify_key(k),
45
+ columns,
46
+ rows: v,
47
+ });
48
+ continue;
49
+ }
50
+ // Declared mismatch → strict fallback (push as scalar so existing JSON
51
+ // formatter renders it visibly under the field's label).
52
+ scalars.push([k, v]);
53
+ continue;
54
+ }
55
+ // Path 2 + 3 merged: declared-scalar OR undeclared. If the value is
56
+ // Array<object>, render as an inferred-column table regardless of whether
57
+ // the field is declared as a plain scalar in expected_fields. (Strict
58
+ // mismatch for declared `array_of: object` is already handled in Path 1
59
+ // above.) This means doctype configs that haven't yet adopted `array_of`
60
+ // still get table rendering when the LLM returns objects, and we never
61
+ // silently downgrade structured data to a JSON-string fallback.
62
+ if (is_array_of_objects(v)) {
63
+ // Infer columns = union of keys across rows, in first-seen order
64
+ const seen = new Set();
65
+ const ordered_keys = [];
66
+ for (const row of v) {
67
+ for (const rk of Object.keys(row)) {
68
+ if (!seen.has(rk)) {
69
+ seen.add(rk);
70
+ ordered_keys.push(rk);
71
+ }
72
+ }
73
+ }
74
+ const columns = ordered_keys.map(rk => ({
75
+ key: rk,
76
+ label: prettify_key(rk),
77
+ }));
78
+ tables.push({
79
+ key: k,
80
+ label: hint?.label ?? prettify_key(k),
81
+ columns,
82
+ rows: v,
83
+ });
84
+ continue;
85
+ }
86
+ if (is_array_of_scalars(v)) {
87
+ lists.push({
88
+ key: k,
89
+ label: hint?.label ?? prettify_key(k),
90
+ items: v,
91
+ });
92
+ continue;
93
+ }
94
+ // Anything else (scalar, empty array, mixed array) → scalar path
95
+ scalars.push([k, v]);
96
+ }
97
+ return { scalars, tables, lists };
98
+ }
99
+ // ============================================================================
100
+ // Component
101
+ // ============================================================================
12
102
  export function ExtractedFieldsInline(props) {
13
- const { item, classification_results, document_types, locale, currency_code, truncate_chars } = props;
103
+ const { item, classification_results, document_types, locale, currency_code, truncate_chars, role, on_request_reextraction } = props;
14
104
  const cr = resolve_classification(item, classification_results);
15
105
  if (!cr)
16
106
  return null;
@@ -20,32 +110,65 @@ export function ExtractedFieldsInline(props) {
20
110
  ? Math.max(0, Math.min(1, cr.confidence))
21
111
  : 0;
22
112
  const has_confidence = typeof cr.confidence === 'number' && cr.confidence > 0;
23
- // Render when there's a date OR renderable fields. Confidence alone is not sufficient.
24
- const has_content = !!document_date || entries.length > 0;
25
- if (!has_content)
26
- return null;
27
- // Doctype lookup for expected_fields hints (label override + type hint).
28
113
  const matched_doctype = document_types?.find(dt => dt.type_id === cr.document_type);
29
114
  const field_index = new Map((matched_doctype?.expected_fields ?? []).map(f => [f.key, f]));
115
+ const partitioned = partition_entries(entries, field_index);
30
116
  const date_display = document_date
31
117
  ? format_extracted_field(document_date, { key: 'document_date', type_hint: 'date', locale }).display
32
118
  : '';
119
+ const can_reextract = role === 'agent' && !!on_request_reextraction;
120
+ const [is_loading, set_is_loading] = React.useState(false);
121
+ async function handle_reextract(scope) {
122
+ if (is_loading || !on_request_reextraction)
123
+ return;
124
+ set_is_loading(true);
125
+ try {
126
+ await Promise.resolve(on_request_reextraction(item.content_id, scope));
127
+ }
128
+ finally {
129
+ set_is_loading(false);
130
+ }
131
+ }
33
132
  const is_replaced = !!item.replaced_by_content_id;
34
133
  const wrapper_class = is_replaced
35
134
  ? 'mt-1 pl-7 text-[12px] leading-relaxed opacity-40'
36
135
  : 'mt-1 pl-7 text-[12px] leading-relaxed';
37
136
  const has_meta = !!document_date || has_confidence;
38
- return (_jsxs("div", { className: wrapper_class, children: [has_meta && (_jsxs("div", { className: "text-[#94A3B8] mb-0.5", children: [document_date && _jsxs("span", { children: [`Document date: `, _jsx("span", { className: "text-[#475569]", children: date_display })] }), document_date && has_confidence && _jsx("span", { className: "mx-1.5 text-[#CBD5E1]", children: "\u00B7" }), has_confidence && _jsx("span", { className: "text-[#475569]", children: `Confidence: ${Math.round(confidence_clamped * 100)}%` })] })), entries.length > 0 && (_jsx("div", { className: "text-[#64748B]", children: entries.map(([k, v], i) => {
39
- const hint = field_index.get(k);
40
- const formatted = format_extracted_field(v, {
41
- key: k,
42
- type_hint: hint?.type,
43
- locale,
44
- currency_code,
45
- truncate_chars,
46
- });
47
- const label = hint?.label ?? prettify_key(k);
48
- return (_jsxs("span", { children: [i > 0 && _jsx("span", { className: "mx-1.5 text-[#CBD5E1]", children: "\u00B7" }), _jsxs("span", { className: "text-[#94A3B8]", children: [label, ": "] }), _jsx("span", { className: "text-[#334155]", title: formatted.title, children: formatted.display })] }, k));
49
- }) }))] }));
137
+ // Confidence alone is not sufficient to render require a date or at least one field.
138
+ const has_content = !!document_date
139
+ || can_reextract
140
+ || partitioned.scalars.length > 0
141
+ || partitioned.tables.length > 0
142
+ || partitioned.lists.length > 0;
143
+ if (!has_content)
144
+ return null;
145
+ function is_numeric(t) {
146
+ return t === 'number' || t === 'currency';
147
+ }
148
+ const dim_class = is_loading ? 'opacity-50 pointer-events-none' : '';
149
+ return (_jsxs("div", { className: wrapper_class, children: [(has_meta || can_reextract) && (_jsxs("div", { className: "text-[#94A3B8] mb-0.5 flex items-center", children: [_jsxs("div", { className: `flex-1 min-w-0 ${dim_class}`, children: [document_date && _jsxs("span", { children: [`Document date: `, _jsx("span", { className: "text-[#475569]", children: date_display })] }), document_date && has_confidence && _jsx("span", { className: "mx-1.5 text-[#CBD5E1]", children: "\u00B7" }), has_confidence && _jsx("span", { className: "text-[#475569]", children: `Confidence: ${Math.round(confidence_clamped * 100)}%` })] }), can_reextract && (_jsxs("div", { className: "ml-2 flex items-center gap-1", children: [_jsx("button", { type: "button", onClick: () => handle_reextract('classification'), disabled: is_loading, className: "text-[#94A3B8] hover:text-[#475569] disabled:opacity-50", title: "Re-extract fields", children: _jsx(LuRefreshCw, { className: `w-3 h-3 ${is_loading ? 'animate-spin' : ''}` }) }), _jsxs(PopoverPrimitive.Root, { modal: true, children: [_jsx(PopoverPrimitive.Trigger, { asChild: true, children: _jsx("button", { type: "button", disabled: is_loading, className: "text-[#94A3B8] hover:text-[#475569] disabled:opacity-50", title: "More re-extract options", children: _jsx(LuEllipsisVertical, { className: "w-3 h-3" }) }) }), _jsx(PopoverPrimitive.Portal, { children: _jsxs(PopoverPrimitive.Content, { align: "end", sideOffset: 4, collisionPadding: 16, className: "z-50 min-w-[180px] rounded-md border border-[#E2E8F0] bg-white py-1 shadow-md text-[12px]", style: { backgroundColor: 'hsl(var(--popover, 0 0% 100%))' }, children: [_jsx("button", { type: "button", onClick: () => handle_reextract('classification'), disabled: is_loading, className: "block w-full text-left px-3 py-1.5 text-[#334155] hover:bg-[#F1F5F9] disabled:opacity-50", children: "Re-extract fields" }), _jsx("button", { type: "button", onClick: () => handle_reextract('full'), disabled: is_loading, className: "block w-full text-left px-3 py-1.5 text-[#334155] hover:bg-[#F1F5F9] disabled:opacity-50", children: "Re-run full analysis" })] }) })] })] }))] })), _jsxs("div", { "data-content-region": true, className: dim_class, children: [partitioned.scalars.length > 0 && (_jsx("div", { className: "text-[#64748B]", children: partitioned.scalars.map(([k, v], i) => {
150
+ const hint = field_index.get(k);
151
+ const formatted = format_extracted_field(v, {
152
+ key: k,
153
+ type_hint: hint?.type,
154
+ locale,
155
+ currency_code,
156
+ truncate_chars,
157
+ });
158
+ const label = hint?.label ?? prettify_key(k);
159
+ return (_jsxs("span", { children: [i > 0 && _jsx("span", { className: "mx-1.5 text-[#CBD5E1]", children: "\u00B7" }), _jsxs("span", { className: "text-[#94A3B8]", children: [label, ": "] }), _jsx("span", { className: "text-[#334155]", title: formatted.title, children: formatted.display })] }, k));
160
+ }) })), partitioned.tables.map(t => (_jsxs("div", { className: "mt-2", children: [_jsx("div", { className: "text-[#475569] font-medium mb-1", children: t.label }), _jsx("div", { className: "overflow-x-auto rounded-md border border-[#E2E8F0] bg-white", children: _jsxs("table", { className: "w-full text-[12px] border-collapse", children: [_jsx("caption", { className: "sr-only", children: t.label }), _jsx("thead", { children: _jsx("tr", { className: "bg-[#F8FAFC] text-[#64748B]", children: t.columns.map(c => (_jsx("th", { scope: "col", className: `px-2 py-1.5 font-medium border-b border-[#E2E8F0] ${is_numeric(c.type) ? 'text-right' : 'text-left'}`, children: c.label }, c.key))) }) }), _jsx("tbody", { children: t.rows.map((row, i) => (_jsx("tr", { className: "text-[#334155] even:bg-[#FAFBFC]", children: t.columns.map(c => {
161
+ const cell = format_extracted_field(row[c.key], {
162
+ key: c.key,
163
+ type_hint: c.type,
164
+ locale,
165
+ currency_code,
166
+ truncate_chars,
167
+ });
168
+ return (_jsx("td", { className: `px-2 py-1 align-top border-t border-[#F1F5F9] first:border-t-0 ${is_numeric(c.type) ? 'text-right tabular-nums' : ''}`, title: cell.title, children: cell.display }, c.key));
169
+ }) }, i))) })] }) })] }, t.key))), partitioned.lists.map(l => (_jsxs("div", { className: "mt-1.5", children: [_jsx("div", { className: "text-[#94A3B8] mb-0.5", children: l.label }), _jsx("ul", { className: "list-disc list-inside text-[#334155] space-y-0.5", children: l.items.map((it, i) => {
170
+ const cell = format_extracted_field(it, { key: l.key, locale, currency_code, truncate_chars });
171
+ return (_jsx("li", { title: cell.title, children: cell.display }, i));
172
+ }) })] }, l.key)))] })] }));
50
173
  }
51
174
  //# sourceMappingURL=extracted_fields_inline.js.map