@ai-matrx/records-ui 0.7.0 → 0.10.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.d.cts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { Uuid as Uuid$1, Table, Field, RecordDocument, ReadRow, RecordsError, WriteConflict, ValueEnvelope, ParityFieldType, RuleExpression, AggregateBucket, AggregateMeasure, DocTemplateRow, DocRenderRow, AnonTokenBinding, RecordsConfig, RecordsActor, RecordsDataSource } from '@ai-matrx/records';
3
+ import { Uuid as Uuid$1, Table, Field, RecordDocument, ReadRow, RecordsError, WriteConflict, ParityFieldType, NewFieldDeclaration, ValueEnvelope, RuleExpression, AggregateBucket, AggregateMeasure, DocTemplateRow, DocRenderRow, AnonTokenBinding, RecordsConfig, RecordsActor, RecordsDataSource } from '@ai-matrx/records';
4
4
  import { Uuid, Field as Field$1, ReadRow as ReadRow$1 } from '@ai-matrx/records/react';
5
5
  import { RecordsClient } from '@ai-matrx/records/core';
6
6
  import { MatrxColumnDef } from '@ai-matrx/design-system/data-table/types';
@@ -188,6 +188,41 @@ interface RecordsUiHost {
188
188
  * queue that silently died with the tab is the failure this exists to avoid.
189
189
  */
190
190
  captureQueue?: CaptureQueuePort;
191
+ /**
192
+ * OPTIONAL. THE HOST'S OWN SHARE DIALOG (SCR-N-5).
193
+ *
194
+ * This package ships no share dialog, ON PURPOSE, and for the same reason it
195
+ * ships no chat: AI Matrx has exactly ONE sharing surface — matrx-frontend's
196
+ * `features/sharing` ShareModal, with its people picker, its level picker, its
197
+ * grant list and its "who can see this, and why" panel — and a second one here
198
+ * would be a parallel sharing UI within a month. Sharing is the access model's
199
+ * front door, and two front doors is how a platform ends up with two answers
200
+ * to "who can see this".
201
+ *
202
+ * So `ShareControl` draws the BUTTON (which belongs on the record and table
203
+ * screens, beside everything else a person does to a thing) and hands the
204
+ * subject to this port, which returns the host's own dialog.
205
+ *
206
+ * Unbound, the button is ABSENT and `NO_SHARE_REASON` says which port to bind.
207
+ * Never a Share button that opens nothing.
208
+ */
209
+ share?: (subject: ShareSubject) => ReactNode;
210
+ }
211
+ /**
212
+ * What a host's share dialog is being opened ON. A Table is a record in this
213
+ * store (a `custom.record` row whose table is the Table kernel), so ONE subject
214
+ * shape covers both screens and `kind` is what the sentences say, not what the
215
+ * store looks up.
216
+ */
217
+ interface ShareSubject {
218
+ kind: "record" | "table";
219
+ /** The store is keyed (organization_id, id); this package never guesses one. */
220
+ organizationId: Uuid$1;
221
+ subjectId: Uuid$1;
222
+ /** What to call it on screen. Never empty — the id's first eight characters at worst. */
223
+ name: string;
224
+ /** Close the dialog. The control owns the open/closed state, the host owns the dialog. */
225
+ onClose: () => void;
191
226
  }
192
227
  /** One member of the organization, in the words a person reads. */
193
228
  interface OrganizationMember {
@@ -223,6 +258,8 @@ interface PendingCapture {
223
258
  declare const NO_SAVED_VIEWS_REASON: string;
224
259
  /** The sentence a person question shows when no membership port is bound. */
225
260
  declare const NO_MEMBERS_REASON: string;
261
+ /** The sentence shown when no share dialog is bound. */
262
+ declare const NO_SHARE_REASON: string;
226
263
  /** The sentence an attachment question shows when no file store is bound. */
227
264
  declare const NO_UPLOAD_REASON: string;
228
265
  declare function RecordsUiProvider({ value, children }: {
@@ -310,12 +347,21 @@ interface GridEditing {
310
347
  /** The value to DRAW for one cell — the optimistic one when there is one. */
311
348
  valueFor: (row: ReadRow, field: Field) => unknown;
312
349
  editing: CellAddress | null;
350
+ /** What has been typed into the open cell. Owned here, never by the cell. */
351
+ draft: unknown;
352
+ /** The open cell's editor reports every keystroke to the session. */
353
+ type: (value: unknown) => void;
313
354
  stateOf: (rowId: Uuid$1, key: string) => CellState;
314
355
  refusalOf: (rowId: Uuid$1, key: string) => CellRefusal | null;
315
356
  begin: (address: CellAddress) => void;
316
357
  cancel: () => void;
317
- /** Commit the open cell. `move` opens the next/previous editable cell after it. */
318
- commit: (value: unknown, move?: "next" | "previous" | null) => void;
358
+ /**
359
+ * Commit the open cell whatever is in `draft`. `move` opens the
360
+ * next/previous editable cell after it. It takes NO value: a caller that
361
+ * passed one would be a second copy of the typed value, which is the defect
362
+ * this file's header describes.
363
+ */
364
+ commit: (move?: "next" | "previous" | null) => void;
319
365
  /** Write the attempted value again, after re-reading the version. */
320
366
  retry: (rowId: Uuid$1, key: string) => void;
321
367
  /** Drop the edit and show what the other person wrote. */
@@ -353,6 +399,9 @@ declare function GridCell({ field, row, editing, canWrite, }: {
353
399
  canWrite: boolean;
354
400
  }): react.JSX.Element;
355
401
 
402
+ declare function hintIsMachineIdentity(hint: string): boolean;
403
+ /** The hint a PERSON should read, or null when the hint is for an engineer. */
404
+ declare function hintForAPerson(hint: string | null | undefined): string | null;
356
405
  declare function RefusalNotice({ error, className, actions, }: {
357
406
  error: RecordsError;
358
407
  className?: string | undefined;
@@ -431,15 +480,69 @@ interface CustomFieldsSectionProps {
431
480
  }
432
481
  declare function CustomFieldsSection({ tableId, entityToken, recordId, title, className, }: CustomFieldsSectionProps): react.JSX.Element | null;
433
482
 
483
+ /** The three behaviours that carry no parity type of their own. */
484
+ type PlainFieldType = "text" | "long_text" | "number";
485
+ /** What a person picks in the panel: one of the thirteen, or one of the three. */
486
+ type PickableFieldType = ParityFieldType | PlainFieldType;
487
+ interface FieldTypeChoice {
488
+ id: PickableFieldType;
489
+ /** The word on the menu. */
490
+ label: string;
491
+ /** One line, under the word, saying what it is FOR. Never what it is made of. */
492
+ explanation: string;
493
+ /** The heading it sits under, so sixteen choices read as four short lists. */
494
+ group: "Words" | "Numbers and dates" | "Choices and people" | "Worked out";
495
+ }
496
+ declare const FIELD_TYPE_CHOICES: FieldTypeChoice[];
497
+ declare const FIELD_TYPE_GROUPS: FieldTypeChoice["group"][];
498
+ declare function fieldTypeChoice(id: string): FieldTypeChoice | undefined;
499
+ /** The three that are a plain behaviour rather than one of the thirteen. */
500
+ declare function isPlainFieldType(id: string): id is PlainFieldType;
501
+ /**
502
+ * THE GUARD THIS FILE NEEDS, because the list it explains is generated.
503
+ *
504
+ * Returns the parity types the store ships that nothing here explains. The
505
+ * suite asserts it is empty; a fourteenth type would otherwise reach the menu
506
+ * with a blank line under it and nobody would notice until a person did.
507
+ */
508
+ declare function parityTypesWithNoExplanation(): string[];
509
+
510
+ /** `Day rate` → `day_rate`. Shown, so nothing about it is a surprise. */
511
+ declare function keyFor(label: string): string;
434
512
  interface FieldEditorProps {
435
513
  tableId: Uuid$1;
436
514
  /** The Field being edited. Absent means a new one. */
437
515
  field?: Field | undefined;
438
516
  onSaved?: (() => void) | undefined;
439
517
  onCancel?: (() => void) | undefined;
518
+ /** Called after the store has accepted the removal, so the list can re-read. */
519
+ onRemoved?: (() => void) | undefined;
440
520
  className?: string | undefined;
441
521
  }
442
- declare function FieldEditor({ tableId, field, onSaved, onCancel, className }: FieldEditorProps): react.JSX.Element;
522
+ declare function FieldEditor({ tableId, field, onSaved, onCancel, onRemoved, className }: FieldEditorProps): react.JSX.Element;
523
+ /**
524
+ * WHAT THE PANEL STILL NEEDS BEFORE THE STORE WOULD TAKE THIS, in plain words.
525
+ *
526
+ * It answers exactly the questions this panel asked, so every sentence names a
527
+ * control the person is looking at. It is NOT a second copy of the store's
528
+ * rules and it is not allowed to become one: the store decides, and every one
529
+ * of these is something the panel can see is unanswered without asking it.
530
+ *
531
+ * Exported so the suite can assert the sentences without driving the whole
532
+ * panel, and so the red twin can assert that removing it puts the contract row
533
+ * id back in front of a person.
534
+ */
535
+ declare function whatIsMissing(state: {
536
+ type: PickableFieldType;
537
+ label: string;
538
+ options: string[];
539
+ via: string;
540
+ pick: string;
541
+ agg: NonNullable<NewFieldDeclaration["agg"]>;
542
+ of: string;
543
+ relations: Field[];
544
+ formulaFields: string[];
545
+ }): string | null;
443
546
 
444
547
  interface FieldProposalRow {
445
548
  id: string;
@@ -523,16 +626,57 @@ declare function RecordChip({ title, onRemove, className, }: {
523
626
  className?: string | undefined;
524
627
  }): react.JSX.Element;
525
628
 
629
+ /** Answers "what is the record with this id called", for one Field's values. */
630
+ type LabelLookup = (field: Field$1, id: string) => string | null;
631
+ /** Which ids a Field's stored value refers to. */
632
+ declare function idsOf(value: unknown): string[];
633
+ declare function isId(value: unknown): boolean;
634
+ /** True when this Field's values are ids of other records rather than values. */
635
+ declare function pointsAtRecords(field: Field$1): boolean;
636
+ declare function RecordLabelProvider({ children }: {
637
+ children: ReactNode;
638
+ }): react.JSX.Element;
639
+ /**
640
+ * The hook a surface uses: it declares the Fields it is about to draw, and gets
641
+ * back the lookup. Declaring is what makes one request per Field instead of one
642
+ * per cell, and it is why a grid of 200 rows asks the store twice.
643
+ */
644
+ declare function useRecordLabels(fields: readonly Field$1[] | undefined): LabelLookup;
645
+
526
646
  /** The envelope for one key, when the document carries one. */
527
647
  declare function envelopeFor(document: RecordDocument | undefined, key: string): ValueEnvelope | undefined;
528
- declare function renderValue(field: Field, value: unknown, document?: RecordDocument): react.JSX.Element;
529
- /** The text of one scalar, with the Field's UNIT and FORMAT applied — FLD-N-1 says both change the MEANING. */
530
- declare function scalarText(field: Field, value: unknown): string;
648
+ declare function renderValue(field: Field, value: unknown, document?: RecordDocument, labels?: LabelLookup): react.JSX.Element;
649
+ /**
650
+ * The text of one scalar, with the Field's UNIT and FORMAT applied — FLD-N-1
651
+ * says both change the MEANING — and with an id resolved to the NAME of the
652
+ * record it points at.
653
+ *
654
+ * `labels` is the resolver from `RecordLabelProvider`. Without it, an id is
655
+ * drawn as "Loading…" and never as itself: a 36-character identifier in a cell
656
+ * reads like a value, and the 19 September verdict found it in choice cells,
657
+ * relation cells and as every Kanban column heading.
658
+ */
659
+ declare function scalarText(field: Field, value: unknown, labels?: LabelLookup): string;
531
660
  /** The provenance badge a value carries when the store interned a source for it (SCR-27). */
532
661
  declare function ProvenanceBadge({ document, fieldKey }: {
533
662
  document: RecordDocument | undefined;
534
663
  fieldKey: string;
535
664
  }): react.JSX.Element | null;
665
+ /**
666
+ * THE VALUE, AS A COMPONENT, so a cell can resolve the ids it holds.
667
+ *
668
+ * `renderValue` is a plain function called from inside a column's `cell`
669
+ * callback and from a dozen other places; a function cannot ask the resolver
670
+ * for a name, because asking is a hook. Every read-only surface therefore draws
671
+ * through this instead, and the one that needs the raw function (a plain-text
672
+ * export, a chat line) keeps calling `renderValue` with no resolver and says
673
+ * "Loading…" rather than printing an id.
674
+ */
675
+ declare function RecordValue({ field, value, document, }: {
676
+ field: Field;
677
+ value: unknown;
678
+ document?: RecordDocument | undefined;
679
+ }): react.JSX.Element;
536
680
 
537
681
  declare const PARITY_LABEL: Record<ParityFieldType, string>;
538
682
  /** The "made of" sentence the store itself publishes, for the field editor's help text. */
@@ -546,7 +690,11 @@ type EditorKind = ParityFieldType | "relation" | "text" | "number" | "boolean" |
546
690
  * value would draw a different editor for an empty record.
547
691
  */
548
692
  declare function editorKindFor(field: Field): EditorKind;
549
- /** The type word a person sees in a header or a settings row. */
693
+ /**
694
+ * The type word a person sees in a header or a settings row — and it is the
695
+ * SAME word the field panel offers, read from `FIELD_TYPE_CHOICES`, so a column
696
+ * added as "Money" is never described anywhere else as "Currency".
697
+ */
550
698
  declare function fieldTypeLabel(field: Field): string;
551
699
 
552
700
  /** One Field of a package-owned Table, in the store's own words. */
@@ -1422,4 +1570,20 @@ declare function addFields(client: RecordsClient, tableId: Uuid$1, fields: NewFi
1422
1570
  error: RecordsError;
1423
1571
  }>;
1424
1572
 
1425
- export { ACTION_KINDS, ACTION_TABLE, ActionInbox, type ActionInboxProps, type ActionKind, BookingSlots, type BookingSlotsProps, CAPTURE_MODES, CHART_KINDS, CHART_KIND_LABEL, CHART_NEEDS, CHECKLIST_TABLE, COMMENT_TABLE, type CaptureMode, type CaptureQueuePort, CaptureSheet, type CaptureSheetProps, type CellAddress, type CellRefusal, type CellState, ChartBlock, type ChartBlockProps, type ChartKind, type ChartSpec, ChecklistRunner, type ChecklistRunnerProps, type ChecklistSpec, type ChecklistStepSpec, CommentThread, type CommentThreadProps, CustomFieldsSection, type CustomFieldsSectionProps, DASHBOARD_TABLE, DEFAULT_FIELDS, DEFAULT_VIEW_NAME, DashboardCanvas, type DashboardCanvasProps, type DashboardSpec, type DeclareResult, DocRender, type DocRenderProps, DocTemplate, type DocTemplateProps, type DocTemplateSpec, type EditorKind, EmbedFrame, type EmbedFrameProps, type EnrichAsk, type EnrichOutcome, EnrichPanel, type EnrichPanelProps, ExportMenu, type ExportMenuProps, FORM_FLOWS, FORM_TABLE, FieldControl, FieldEditor, type FieldEditorControlProps, type FieldEditorProps, FieldLabel, type FieldProposalRow, FormBuilder, type FormBuilderProps, type FormFlow, type FormQuestionSpec, FormRunner, type FormRunnerProps, type FormSpec, type FormTheme, Grid, GridCell, type GridEditing, type GridProps, HistoryPanel, type HistoryPanelProps, IN_MEMORY_QUEUE_REASON, ImportWizard, type ImportWizardProps, KERNEL_REASON, LANE_EMPTY, LANE_TITLE, LAYOUT_FIELD_KIND, LAYOUT_LABEL, LAYOUT_NEEDS, LAYOUT_NO_FIELD, NO_CHAT_REASON, NO_ENRICH_REASON, NO_MEMBERS_REASON, NO_RIGHTS, NO_SAVED_VIEWS_REASON, NO_UPLOAD_REASON, type NewFieldSpec, type NewTableSpec, NotifyRuleEditor, type NotifyRuleEditorProps, type NotifyRuleSpec, type OrganizationMember, PARITY_LABEL, PARITY_MADE_OF, Peek, type PeekProps, type PendingCapture, PersonPicker, type PersonPickerProps, PortalShell, type PortalShellProps, type ProposalOutcome, ProposalRow, type ProposalRowProps, type ProposedChange, ProvenanceBadge, PublicViewPage, type PublicViewPageProps, type QueuedAction, type QueuedActionSpec, RecordChat, type RecordChatContext, type RecordChatEntry, type RecordChatProps, type RecordChatWithheld, RecordChip, RecordForm, type RecordFormProps, RecordsMount, type RecordsMountProps, type RecordsUiHost, RecordsUiProvider, RefusalLine, RefusalNotice, RelationPicker, type RelationPickerProps, SERIES_COLORS, STORE_DECIDES_REASON, type SavedDashboard, type SavedForm, type SavedView, type SavedViewSpec, SignBlock, type SignBlockProps, type SystemFieldSpec, type SystemTableSpec, TABLE_LANES, TABLE_NOT_REACHABLE, type TableLane, TablePage, type TablePageProps, type TableRights, TableSettings, type TableSettingsProps, TablesHome, type TablesHomeProps, type TrackedVersion, type UseSystemTableState, VIEW_LAYOUTS, VIEW_TABLE, ViewBar, type ViewBarProps, type ViewLayout, type ViewSort, ViewSwitcher, type ViewSwitcherProps, actionDocument, addFields, bodyForReading, bodyFromKeys, columnForField, dashboardDocument, dashboardFromRecord, declareTable, editorKindFor, ensureSystemTable, envelopeFor, fieldIsEditable, fieldName, fieldToken, fieldTypeLabel, formDocument, formFromRecord, groupLabel, humanize, isSignatureField, laneFor, memberName, personActor, personRecordForMember, recordName, recordsDataSource, renderValue, rowName, scalarText, storeDecidesRights, submissionStamp, tableName, tokenFor, useEmbedHandshake, useGridEditing, useRecordsUi, useSystemTable, useTableRights, useViewRecords, viewDocument, viewFromRecord, viewPatchDocument };
1573
+ interface ShareControlProps {
1574
+ kind: ShareSubject["kind"];
1575
+ organizationId: Uuid$1;
1576
+ subjectId: Uuid$1;
1577
+ /** What to call it in the dialog's title. */
1578
+ name?: string | undefined;
1579
+ size?: "sm" | "default" | undefined;
1580
+ variant?: "ghost" | "outline" | "default" | undefined;
1581
+ className?: string | undefined;
1582
+ }
1583
+ /** True when a host has bound a share dialog — so a caller can lay out its row. */
1584
+ declare function useCanShare(): boolean;
1585
+ /** Why there is no Share button here, for anything that asks. */
1586
+ declare function shareUnavailableReason(): string;
1587
+ declare function ShareControl({ kind, organizationId, subjectId, name, size, variant, className, }: ShareControlProps): ReactNode;
1588
+
1589
+ export { ACTION_KINDS, ACTION_TABLE, ActionInbox, type ActionInboxProps, type ActionKind, BookingSlots, type BookingSlotsProps, CAPTURE_MODES, CHART_KINDS, CHART_KIND_LABEL, CHART_NEEDS, CHECKLIST_TABLE, COMMENT_TABLE, type CaptureMode, type CaptureQueuePort, CaptureSheet, type CaptureSheetProps, type CellAddress, type CellRefusal, type CellState, ChartBlock, type ChartBlockProps, type ChartKind, type ChartSpec, ChecklistRunner, type ChecklistRunnerProps, type ChecklistSpec, type ChecklistStepSpec, CommentThread, type CommentThreadProps, CustomFieldsSection, type CustomFieldsSectionProps, DASHBOARD_TABLE, DEFAULT_FIELDS, DEFAULT_VIEW_NAME, DashboardCanvas, type DashboardCanvasProps, type DashboardSpec, type DeclareResult, DocRender, type DocRenderProps, DocTemplate, type DocTemplateProps, type DocTemplateSpec, type EditorKind, EmbedFrame, type EmbedFrameProps, type EnrichAsk, type EnrichOutcome, EnrichPanel, type EnrichPanelProps, ExportMenu, type ExportMenuProps, FIELD_TYPE_CHOICES, FIELD_TYPE_GROUPS, FORM_FLOWS, FORM_TABLE, FieldControl, FieldEditor, type FieldEditorControlProps, type FieldEditorProps, FieldLabel, type FieldProposalRow, type FieldTypeChoice, FormBuilder, type FormBuilderProps, type FormFlow, type FormQuestionSpec, FormRunner, type FormRunnerProps, type FormSpec, type FormTheme, Grid, GridCell, type GridEditing, type GridProps, HistoryPanel, type HistoryPanelProps, IN_MEMORY_QUEUE_REASON, ImportWizard, type ImportWizardProps, KERNEL_REASON, LANE_EMPTY, LANE_TITLE, LAYOUT_FIELD_KIND, LAYOUT_LABEL, LAYOUT_NEEDS, LAYOUT_NO_FIELD, type LabelLookup, NO_CHAT_REASON, NO_ENRICH_REASON, NO_MEMBERS_REASON, NO_RIGHTS, NO_SAVED_VIEWS_REASON, NO_SHARE_REASON, NO_UPLOAD_REASON, type NewFieldSpec, type NewTableSpec, NotifyRuleEditor, type NotifyRuleEditorProps, type NotifyRuleSpec, type OrganizationMember, PARITY_LABEL, PARITY_MADE_OF, Peek, type PeekProps, type PendingCapture, PersonPicker, type PersonPickerProps, type PickableFieldType, type PlainFieldType, PortalShell, type PortalShellProps, type ProposalOutcome, ProposalRow, type ProposalRowProps, type ProposedChange, ProvenanceBadge, PublicViewPage, type PublicViewPageProps, type QueuedAction, type QueuedActionSpec, RecordChat, type RecordChatContext, type RecordChatEntry, type RecordChatProps, type RecordChatWithheld, RecordChip, RecordForm, type RecordFormProps, RecordLabelProvider, RecordValue, RecordsMount, type RecordsMountProps, type RecordsUiHost, RecordsUiProvider, RefusalLine, RefusalNotice, RelationPicker, type RelationPickerProps, SERIES_COLORS, STORE_DECIDES_REASON, type SavedDashboard, type SavedForm, type SavedView, type SavedViewSpec, ShareControl, type ShareControlProps, type ShareSubject, SignBlock, type SignBlockProps, type SystemFieldSpec, type SystemTableSpec, TABLE_LANES, TABLE_NOT_REACHABLE, type TableLane, TablePage, type TablePageProps, type TableRights, TableSettings, type TableSettingsProps, TablesHome, type TablesHomeProps, type TrackedVersion, type UseSystemTableState, VIEW_LAYOUTS, VIEW_TABLE, ViewBar, type ViewBarProps, type ViewLayout, type ViewSort, ViewSwitcher, type ViewSwitcherProps, actionDocument, addFields, bodyForReading, bodyFromKeys, columnForField, dashboardDocument, dashboardFromRecord, declareTable, editorKindFor, ensureSystemTable, envelopeFor, fieldIsEditable, fieldName, fieldToken, fieldTypeChoice, fieldTypeLabel, formDocument, formFromRecord, groupLabel, hintForAPerson, hintIsMachineIdentity, humanize, idsOf, isId, isPlainFieldType, isSignatureField, keyFor, laneFor, memberName, parityTypesWithNoExplanation, personActor, personRecordForMember, pointsAtRecords, recordName, recordsDataSource, renderValue, rowName, scalarText, shareUnavailableReason, storeDecidesRights, submissionStamp, tableName, tokenFor, useCanShare, useEmbedHandshake, useGridEditing, useRecordLabels, useRecordsUi, useSystemTable, useTableRights, useViewRecords, viewDocument, viewFromRecord, viewPatchDocument, whatIsMissing };
package/dist/index.d.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import * as react from 'react';
2
2
  import { ReactNode } from 'react';
3
- import { Uuid as Uuid$1, Table, Field, RecordDocument, ReadRow, RecordsError, WriteConflict, ValueEnvelope, ParityFieldType, RuleExpression, AggregateBucket, AggregateMeasure, DocTemplateRow, DocRenderRow, AnonTokenBinding, RecordsConfig, RecordsActor, RecordsDataSource } from '@ai-matrx/records';
3
+ import { Uuid as Uuid$1, Table, Field, RecordDocument, ReadRow, RecordsError, WriteConflict, ParityFieldType, NewFieldDeclaration, ValueEnvelope, RuleExpression, AggregateBucket, AggregateMeasure, DocTemplateRow, DocRenderRow, AnonTokenBinding, RecordsConfig, RecordsActor, RecordsDataSource } from '@ai-matrx/records';
4
4
  import { Uuid, Field as Field$1, ReadRow as ReadRow$1 } from '@ai-matrx/records/react';
5
5
  import { RecordsClient } from '@ai-matrx/records/core';
6
6
  import { MatrxColumnDef } from '@ai-matrx/design-system/data-table/types';
@@ -188,6 +188,41 @@ interface RecordsUiHost {
188
188
  * queue that silently died with the tab is the failure this exists to avoid.
189
189
  */
190
190
  captureQueue?: CaptureQueuePort;
191
+ /**
192
+ * OPTIONAL. THE HOST'S OWN SHARE DIALOG (SCR-N-5).
193
+ *
194
+ * This package ships no share dialog, ON PURPOSE, and for the same reason it
195
+ * ships no chat: AI Matrx has exactly ONE sharing surface — matrx-frontend's
196
+ * `features/sharing` ShareModal, with its people picker, its level picker, its
197
+ * grant list and its "who can see this, and why" panel — and a second one here
198
+ * would be a parallel sharing UI within a month. Sharing is the access model's
199
+ * front door, and two front doors is how a platform ends up with two answers
200
+ * to "who can see this".
201
+ *
202
+ * So `ShareControl` draws the BUTTON (which belongs on the record and table
203
+ * screens, beside everything else a person does to a thing) and hands the
204
+ * subject to this port, which returns the host's own dialog.
205
+ *
206
+ * Unbound, the button is ABSENT and `NO_SHARE_REASON` says which port to bind.
207
+ * Never a Share button that opens nothing.
208
+ */
209
+ share?: (subject: ShareSubject) => ReactNode;
210
+ }
211
+ /**
212
+ * What a host's share dialog is being opened ON. A Table is a record in this
213
+ * store (a `custom.record` row whose table is the Table kernel), so ONE subject
214
+ * shape covers both screens and `kind` is what the sentences say, not what the
215
+ * store looks up.
216
+ */
217
+ interface ShareSubject {
218
+ kind: "record" | "table";
219
+ /** The store is keyed (organization_id, id); this package never guesses one. */
220
+ organizationId: Uuid$1;
221
+ subjectId: Uuid$1;
222
+ /** What to call it on screen. Never empty — the id's first eight characters at worst. */
223
+ name: string;
224
+ /** Close the dialog. The control owns the open/closed state, the host owns the dialog. */
225
+ onClose: () => void;
191
226
  }
192
227
  /** One member of the organization, in the words a person reads. */
193
228
  interface OrganizationMember {
@@ -223,6 +258,8 @@ interface PendingCapture {
223
258
  declare const NO_SAVED_VIEWS_REASON: string;
224
259
  /** The sentence a person question shows when no membership port is bound. */
225
260
  declare const NO_MEMBERS_REASON: string;
261
+ /** The sentence shown when no share dialog is bound. */
262
+ declare const NO_SHARE_REASON: string;
226
263
  /** The sentence an attachment question shows when no file store is bound. */
227
264
  declare const NO_UPLOAD_REASON: string;
228
265
  declare function RecordsUiProvider({ value, children }: {
@@ -310,12 +347,21 @@ interface GridEditing {
310
347
  /** The value to DRAW for one cell — the optimistic one when there is one. */
311
348
  valueFor: (row: ReadRow, field: Field) => unknown;
312
349
  editing: CellAddress | null;
350
+ /** What has been typed into the open cell. Owned here, never by the cell. */
351
+ draft: unknown;
352
+ /** The open cell's editor reports every keystroke to the session. */
353
+ type: (value: unknown) => void;
313
354
  stateOf: (rowId: Uuid$1, key: string) => CellState;
314
355
  refusalOf: (rowId: Uuid$1, key: string) => CellRefusal | null;
315
356
  begin: (address: CellAddress) => void;
316
357
  cancel: () => void;
317
- /** Commit the open cell. `move` opens the next/previous editable cell after it. */
318
- commit: (value: unknown, move?: "next" | "previous" | null) => void;
358
+ /**
359
+ * Commit the open cell whatever is in `draft`. `move` opens the
360
+ * next/previous editable cell after it. It takes NO value: a caller that
361
+ * passed one would be a second copy of the typed value, which is the defect
362
+ * this file's header describes.
363
+ */
364
+ commit: (move?: "next" | "previous" | null) => void;
319
365
  /** Write the attempted value again, after re-reading the version. */
320
366
  retry: (rowId: Uuid$1, key: string) => void;
321
367
  /** Drop the edit and show what the other person wrote. */
@@ -353,6 +399,9 @@ declare function GridCell({ field, row, editing, canWrite, }: {
353
399
  canWrite: boolean;
354
400
  }): react.JSX.Element;
355
401
 
402
+ declare function hintIsMachineIdentity(hint: string): boolean;
403
+ /** The hint a PERSON should read, or null when the hint is for an engineer. */
404
+ declare function hintForAPerson(hint: string | null | undefined): string | null;
356
405
  declare function RefusalNotice({ error, className, actions, }: {
357
406
  error: RecordsError;
358
407
  className?: string | undefined;
@@ -431,15 +480,69 @@ interface CustomFieldsSectionProps {
431
480
  }
432
481
  declare function CustomFieldsSection({ tableId, entityToken, recordId, title, className, }: CustomFieldsSectionProps): react.JSX.Element | null;
433
482
 
483
+ /** The three behaviours that carry no parity type of their own. */
484
+ type PlainFieldType = "text" | "long_text" | "number";
485
+ /** What a person picks in the panel: one of the thirteen, or one of the three. */
486
+ type PickableFieldType = ParityFieldType | PlainFieldType;
487
+ interface FieldTypeChoice {
488
+ id: PickableFieldType;
489
+ /** The word on the menu. */
490
+ label: string;
491
+ /** One line, under the word, saying what it is FOR. Never what it is made of. */
492
+ explanation: string;
493
+ /** The heading it sits under, so sixteen choices read as four short lists. */
494
+ group: "Words" | "Numbers and dates" | "Choices and people" | "Worked out";
495
+ }
496
+ declare const FIELD_TYPE_CHOICES: FieldTypeChoice[];
497
+ declare const FIELD_TYPE_GROUPS: FieldTypeChoice["group"][];
498
+ declare function fieldTypeChoice(id: string): FieldTypeChoice | undefined;
499
+ /** The three that are a plain behaviour rather than one of the thirteen. */
500
+ declare function isPlainFieldType(id: string): id is PlainFieldType;
501
+ /**
502
+ * THE GUARD THIS FILE NEEDS, because the list it explains is generated.
503
+ *
504
+ * Returns the parity types the store ships that nothing here explains. The
505
+ * suite asserts it is empty; a fourteenth type would otherwise reach the menu
506
+ * with a blank line under it and nobody would notice until a person did.
507
+ */
508
+ declare function parityTypesWithNoExplanation(): string[];
509
+
510
+ /** `Day rate` → `day_rate`. Shown, so nothing about it is a surprise. */
511
+ declare function keyFor(label: string): string;
434
512
  interface FieldEditorProps {
435
513
  tableId: Uuid$1;
436
514
  /** The Field being edited. Absent means a new one. */
437
515
  field?: Field | undefined;
438
516
  onSaved?: (() => void) | undefined;
439
517
  onCancel?: (() => void) | undefined;
518
+ /** Called after the store has accepted the removal, so the list can re-read. */
519
+ onRemoved?: (() => void) | undefined;
440
520
  className?: string | undefined;
441
521
  }
442
- declare function FieldEditor({ tableId, field, onSaved, onCancel, className }: FieldEditorProps): react.JSX.Element;
522
+ declare function FieldEditor({ tableId, field, onSaved, onCancel, onRemoved, className }: FieldEditorProps): react.JSX.Element;
523
+ /**
524
+ * WHAT THE PANEL STILL NEEDS BEFORE THE STORE WOULD TAKE THIS, in plain words.
525
+ *
526
+ * It answers exactly the questions this panel asked, so every sentence names a
527
+ * control the person is looking at. It is NOT a second copy of the store's
528
+ * rules and it is not allowed to become one: the store decides, and every one
529
+ * of these is something the panel can see is unanswered without asking it.
530
+ *
531
+ * Exported so the suite can assert the sentences without driving the whole
532
+ * panel, and so the red twin can assert that removing it puts the contract row
533
+ * id back in front of a person.
534
+ */
535
+ declare function whatIsMissing(state: {
536
+ type: PickableFieldType;
537
+ label: string;
538
+ options: string[];
539
+ via: string;
540
+ pick: string;
541
+ agg: NonNullable<NewFieldDeclaration["agg"]>;
542
+ of: string;
543
+ relations: Field[];
544
+ formulaFields: string[];
545
+ }): string | null;
443
546
 
444
547
  interface FieldProposalRow {
445
548
  id: string;
@@ -523,16 +626,57 @@ declare function RecordChip({ title, onRemove, className, }: {
523
626
  className?: string | undefined;
524
627
  }): react.JSX.Element;
525
628
 
629
+ /** Answers "what is the record with this id called", for one Field's values. */
630
+ type LabelLookup = (field: Field$1, id: string) => string | null;
631
+ /** Which ids a Field's stored value refers to. */
632
+ declare function idsOf(value: unknown): string[];
633
+ declare function isId(value: unknown): boolean;
634
+ /** True when this Field's values are ids of other records rather than values. */
635
+ declare function pointsAtRecords(field: Field$1): boolean;
636
+ declare function RecordLabelProvider({ children }: {
637
+ children: ReactNode;
638
+ }): react.JSX.Element;
639
+ /**
640
+ * The hook a surface uses: it declares the Fields it is about to draw, and gets
641
+ * back the lookup. Declaring is what makes one request per Field instead of one
642
+ * per cell, and it is why a grid of 200 rows asks the store twice.
643
+ */
644
+ declare function useRecordLabels(fields: readonly Field$1[] | undefined): LabelLookup;
645
+
526
646
  /** The envelope for one key, when the document carries one. */
527
647
  declare function envelopeFor(document: RecordDocument | undefined, key: string): ValueEnvelope | undefined;
528
- declare function renderValue(field: Field, value: unknown, document?: RecordDocument): react.JSX.Element;
529
- /** The text of one scalar, with the Field's UNIT and FORMAT applied — FLD-N-1 says both change the MEANING. */
530
- declare function scalarText(field: Field, value: unknown): string;
648
+ declare function renderValue(field: Field, value: unknown, document?: RecordDocument, labels?: LabelLookup): react.JSX.Element;
649
+ /**
650
+ * The text of one scalar, with the Field's UNIT and FORMAT applied — FLD-N-1
651
+ * says both change the MEANING — and with an id resolved to the NAME of the
652
+ * record it points at.
653
+ *
654
+ * `labels` is the resolver from `RecordLabelProvider`. Without it, an id is
655
+ * drawn as "Loading…" and never as itself: a 36-character identifier in a cell
656
+ * reads like a value, and the 19 September verdict found it in choice cells,
657
+ * relation cells and as every Kanban column heading.
658
+ */
659
+ declare function scalarText(field: Field, value: unknown, labels?: LabelLookup): string;
531
660
  /** The provenance badge a value carries when the store interned a source for it (SCR-27). */
532
661
  declare function ProvenanceBadge({ document, fieldKey }: {
533
662
  document: RecordDocument | undefined;
534
663
  fieldKey: string;
535
664
  }): react.JSX.Element | null;
665
+ /**
666
+ * THE VALUE, AS A COMPONENT, so a cell can resolve the ids it holds.
667
+ *
668
+ * `renderValue` is a plain function called from inside a column's `cell`
669
+ * callback and from a dozen other places; a function cannot ask the resolver
670
+ * for a name, because asking is a hook. Every read-only surface therefore draws
671
+ * through this instead, and the one that needs the raw function (a plain-text
672
+ * export, a chat line) keeps calling `renderValue` with no resolver and says
673
+ * "Loading…" rather than printing an id.
674
+ */
675
+ declare function RecordValue({ field, value, document, }: {
676
+ field: Field;
677
+ value: unknown;
678
+ document?: RecordDocument | undefined;
679
+ }): react.JSX.Element;
536
680
 
537
681
  declare const PARITY_LABEL: Record<ParityFieldType, string>;
538
682
  /** The "made of" sentence the store itself publishes, for the field editor's help text. */
@@ -546,7 +690,11 @@ type EditorKind = ParityFieldType | "relation" | "text" | "number" | "boolean" |
546
690
  * value would draw a different editor for an empty record.
547
691
  */
548
692
  declare function editorKindFor(field: Field): EditorKind;
549
- /** The type word a person sees in a header or a settings row. */
693
+ /**
694
+ * The type word a person sees in a header or a settings row — and it is the
695
+ * SAME word the field panel offers, read from `FIELD_TYPE_CHOICES`, so a column
696
+ * added as "Money" is never described anywhere else as "Currency".
697
+ */
550
698
  declare function fieldTypeLabel(field: Field): string;
551
699
 
552
700
  /** One Field of a package-owned Table, in the store's own words. */
@@ -1422,4 +1570,20 @@ declare function addFields(client: RecordsClient, tableId: Uuid$1, fields: NewFi
1422
1570
  error: RecordsError;
1423
1571
  }>;
1424
1572
 
1425
- export { ACTION_KINDS, ACTION_TABLE, ActionInbox, type ActionInboxProps, type ActionKind, BookingSlots, type BookingSlotsProps, CAPTURE_MODES, CHART_KINDS, CHART_KIND_LABEL, CHART_NEEDS, CHECKLIST_TABLE, COMMENT_TABLE, type CaptureMode, type CaptureQueuePort, CaptureSheet, type CaptureSheetProps, type CellAddress, type CellRefusal, type CellState, ChartBlock, type ChartBlockProps, type ChartKind, type ChartSpec, ChecklistRunner, type ChecklistRunnerProps, type ChecklistSpec, type ChecklistStepSpec, CommentThread, type CommentThreadProps, CustomFieldsSection, type CustomFieldsSectionProps, DASHBOARD_TABLE, DEFAULT_FIELDS, DEFAULT_VIEW_NAME, DashboardCanvas, type DashboardCanvasProps, type DashboardSpec, type DeclareResult, DocRender, type DocRenderProps, DocTemplate, type DocTemplateProps, type DocTemplateSpec, type EditorKind, EmbedFrame, type EmbedFrameProps, type EnrichAsk, type EnrichOutcome, EnrichPanel, type EnrichPanelProps, ExportMenu, type ExportMenuProps, FORM_FLOWS, FORM_TABLE, FieldControl, FieldEditor, type FieldEditorControlProps, type FieldEditorProps, FieldLabel, type FieldProposalRow, FormBuilder, type FormBuilderProps, type FormFlow, type FormQuestionSpec, FormRunner, type FormRunnerProps, type FormSpec, type FormTheme, Grid, GridCell, type GridEditing, type GridProps, HistoryPanel, type HistoryPanelProps, IN_MEMORY_QUEUE_REASON, ImportWizard, type ImportWizardProps, KERNEL_REASON, LANE_EMPTY, LANE_TITLE, LAYOUT_FIELD_KIND, LAYOUT_LABEL, LAYOUT_NEEDS, LAYOUT_NO_FIELD, NO_CHAT_REASON, NO_ENRICH_REASON, NO_MEMBERS_REASON, NO_RIGHTS, NO_SAVED_VIEWS_REASON, NO_UPLOAD_REASON, type NewFieldSpec, type NewTableSpec, NotifyRuleEditor, type NotifyRuleEditorProps, type NotifyRuleSpec, type OrganizationMember, PARITY_LABEL, PARITY_MADE_OF, Peek, type PeekProps, type PendingCapture, PersonPicker, type PersonPickerProps, PortalShell, type PortalShellProps, type ProposalOutcome, ProposalRow, type ProposalRowProps, type ProposedChange, ProvenanceBadge, PublicViewPage, type PublicViewPageProps, type QueuedAction, type QueuedActionSpec, RecordChat, type RecordChatContext, type RecordChatEntry, type RecordChatProps, type RecordChatWithheld, RecordChip, RecordForm, type RecordFormProps, RecordsMount, type RecordsMountProps, type RecordsUiHost, RecordsUiProvider, RefusalLine, RefusalNotice, RelationPicker, type RelationPickerProps, SERIES_COLORS, STORE_DECIDES_REASON, type SavedDashboard, type SavedForm, type SavedView, type SavedViewSpec, SignBlock, type SignBlockProps, type SystemFieldSpec, type SystemTableSpec, TABLE_LANES, TABLE_NOT_REACHABLE, type TableLane, TablePage, type TablePageProps, type TableRights, TableSettings, type TableSettingsProps, TablesHome, type TablesHomeProps, type TrackedVersion, type UseSystemTableState, VIEW_LAYOUTS, VIEW_TABLE, ViewBar, type ViewBarProps, type ViewLayout, type ViewSort, ViewSwitcher, type ViewSwitcherProps, actionDocument, addFields, bodyForReading, bodyFromKeys, columnForField, dashboardDocument, dashboardFromRecord, declareTable, editorKindFor, ensureSystemTable, envelopeFor, fieldIsEditable, fieldName, fieldToken, fieldTypeLabel, formDocument, formFromRecord, groupLabel, humanize, isSignatureField, laneFor, memberName, personActor, personRecordForMember, recordName, recordsDataSource, renderValue, rowName, scalarText, storeDecidesRights, submissionStamp, tableName, tokenFor, useEmbedHandshake, useGridEditing, useRecordsUi, useSystemTable, useTableRights, useViewRecords, viewDocument, viewFromRecord, viewPatchDocument };
1573
+ interface ShareControlProps {
1574
+ kind: ShareSubject["kind"];
1575
+ organizationId: Uuid$1;
1576
+ subjectId: Uuid$1;
1577
+ /** What to call it in the dialog's title. */
1578
+ name?: string | undefined;
1579
+ size?: "sm" | "default" | undefined;
1580
+ variant?: "ghost" | "outline" | "default" | undefined;
1581
+ className?: string | undefined;
1582
+ }
1583
+ /** True when a host has bound a share dialog — so a caller can lay out its row. */
1584
+ declare function useCanShare(): boolean;
1585
+ /** Why there is no Share button here, for anything that asks. */
1586
+ declare function shareUnavailableReason(): string;
1587
+ declare function ShareControl({ kind, organizationId, subjectId, name, size, variant, className, }: ShareControlProps): ReactNode;
1588
+
1589
+ export { ACTION_KINDS, ACTION_TABLE, ActionInbox, type ActionInboxProps, type ActionKind, BookingSlots, type BookingSlotsProps, CAPTURE_MODES, CHART_KINDS, CHART_KIND_LABEL, CHART_NEEDS, CHECKLIST_TABLE, COMMENT_TABLE, type CaptureMode, type CaptureQueuePort, CaptureSheet, type CaptureSheetProps, type CellAddress, type CellRefusal, type CellState, ChartBlock, type ChartBlockProps, type ChartKind, type ChartSpec, ChecklistRunner, type ChecklistRunnerProps, type ChecklistSpec, type ChecklistStepSpec, CommentThread, type CommentThreadProps, CustomFieldsSection, type CustomFieldsSectionProps, DASHBOARD_TABLE, DEFAULT_FIELDS, DEFAULT_VIEW_NAME, DashboardCanvas, type DashboardCanvasProps, type DashboardSpec, type DeclareResult, DocRender, type DocRenderProps, DocTemplate, type DocTemplateProps, type DocTemplateSpec, type EditorKind, EmbedFrame, type EmbedFrameProps, type EnrichAsk, type EnrichOutcome, EnrichPanel, type EnrichPanelProps, ExportMenu, type ExportMenuProps, FIELD_TYPE_CHOICES, FIELD_TYPE_GROUPS, FORM_FLOWS, FORM_TABLE, FieldControl, FieldEditor, type FieldEditorControlProps, type FieldEditorProps, FieldLabel, type FieldProposalRow, type FieldTypeChoice, FormBuilder, type FormBuilderProps, type FormFlow, type FormQuestionSpec, FormRunner, type FormRunnerProps, type FormSpec, type FormTheme, Grid, GridCell, type GridEditing, type GridProps, HistoryPanel, type HistoryPanelProps, IN_MEMORY_QUEUE_REASON, ImportWizard, type ImportWizardProps, KERNEL_REASON, LANE_EMPTY, LANE_TITLE, LAYOUT_FIELD_KIND, LAYOUT_LABEL, LAYOUT_NEEDS, LAYOUT_NO_FIELD, type LabelLookup, NO_CHAT_REASON, NO_ENRICH_REASON, NO_MEMBERS_REASON, NO_RIGHTS, NO_SAVED_VIEWS_REASON, NO_SHARE_REASON, NO_UPLOAD_REASON, type NewFieldSpec, type NewTableSpec, NotifyRuleEditor, type NotifyRuleEditorProps, type NotifyRuleSpec, type OrganizationMember, PARITY_LABEL, PARITY_MADE_OF, Peek, type PeekProps, type PendingCapture, PersonPicker, type PersonPickerProps, type PickableFieldType, type PlainFieldType, PortalShell, type PortalShellProps, type ProposalOutcome, ProposalRow, type ProposalRowProps, type ProposedChange, ProvenanceBadge, PublicViewPage, type PublicViewPageProps, type QueuedAction, type QueuedActionSpec, RecordChat, type RecordChatContext, type RecordChatEntry, type RecordChatProps, type RecordChatWithheld, RecordChip, RecordForm, type RecordFormProps, RecordLabelProvider, RecordValue, RecordsMount, type RecordsMountProps, type RecordsUiHost, RecordsUiProvider, RefusalLine, RefusalNotice, RelationPicker, type RelationPickerProps, SERIES_COLORS, STORE_DECIDES_REASON, type SavedDashboard, type SavedForm, type SavedView, type SavedViewSpec, ShareControl, type ShareControlProps, type ShareSubject, SignBlock, type SignBlockProps, type SystemFieldSpec, type SystemTableSpec, TABLE_LANES, TABLE_NOT_REACHABLE, type TableLane, TablePage, type TablePageProps, type TableRights, TableSettings, type TableSettingsProps, TablesHome, type TablesHomeProps, type TrackedVersion, type UseSystemTableState, VIEW_LAYOUTS, VIEW_TABLE, ViewBar, type ViewBarProps, type ViewLayout, type ViewSort, ViewSwitcher, type ViewSwitcherProps, actionDocument, addFields, bodyForReading, bodyFromKeys, columnForField, dashboardDocument, dashboardFromRecord, declareTable, editorKindFor, ensureSystemTable, envelopeFor, fieldIsEditable, fieldName, fieldToken, fieldTypeChoice, fieldTypeLabel, formDocument, formFromRecord, groupLabel, hintForAPerson, hintIsMachineIdentity, humanize, idsOf, isId, isPlainFieldType, isSignatureField, keyFor, laneFor, memberName, parityTypesWithNoExplanation, personActor, personRecordForMember, pointsAtRecords, recordName, recordsDataSource, renderValue, rowName, scalarText, shareUnavailableReason, storeDecidesRights, submissionStamp, tableName, tokenFor, useCanShare, useEmbedHandshake, useGridEditing, useRecordLabels, useRecordsUi, useSystemTable, useTableRights, useViewRecords, viewDocument, viewFromRecord, viewPatchDocument, whatIsMissing };