@ai-matrx/design-system 0.25.0 → 0.27.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.
Files changed (81) hide show
  1. package/CHANGELOG.md +94 -0
  2. package/dist/data-table/copy-helpers.cjs.map +1 -1
  3. package/dist/data-table/copy-helpers.d.cts +3 -1
  4. package/dist/data-table/copy-helpers.d.ts +3 -1
  5. package/dist/data-table/copy-helpers.js.map +1 -1
  6. package/dist/data-table/data-row-inspector.cjs.map +1 -1
  7. package/dist/data-table/data-row-inspector.js.map +1 -1
  8. package/dist/data-table/data-row-window.cjs.map +1 -1
  9. package/dist/data-table/data-row-window.js.map +1 -1
  10. package/dist/data-table/date-filter.cjs +145 -0
  11. package/dist/data-table/date-filter.cjs.map +1 -0
  12. package/dist/data-table/date-filter.d.cts +31 -0
  13. package/dist/data-table/date-filter.d.ts +31 -0
  14. package/dist/data-table/date-filter.js +125 -0
  15. package/dist/data-table/date-filter.js.map +1 -0
  16. package/dist/data-table/facets.cjs +118 -0
  17. package/dist/data-table/facets.cjs.map +1 -0
  18. package/dist/data-table/facets.d.cts +100 -0
  19. package/dist/data-table/facets.d.ts +100 -0
  20. package/dist/data-table/facets.js +98 -0
  21. package/dist/data-table/facets.js.map +1 -0
  22. package/dist/data-table/filter-engine.cjs +88 -0
  23. package/dist/data-table/filter-engine.cjs.map +1 -1
  24. package/dist/data-table/filter-engine.d.cts +3 -1
  25. package/dist/data-table/filter-engine.d.ts +3 -1
  26. package/dist/data-table/filter-engine.js +88 -0
  27. package/dist/data-table/filter-engine.js.map +1 -1
  28. package/dist/data-table/host.cjs.map +1 -1
  29. package/dist/data-table/host.d.cts +14 -3
  30. package/dist/data-table/host.d.ts +14 -3
  31. package/dist/data-table/host.js.map +1 -1
  32. package/dist/data-table/index.cjs +918 -152
  33. package/dist/data-table/index.cjs.map +1 -1
  34. package/dist/data-table/index.d.cts +5 -2
  35. package/dist/data-table/index.d.ts +5 -2
  36. package/dist/data-table/index.js +956 -189
  37. package/dist/data-table/index.js.map +1 -1
  38. package/dist/data-table/infer-filter.cjs +2 -0
  39. package/dist/data-table/infer-filter.cjs.map +1 -1
  40. package/dist/data-table/infer-filter.d.cts +4 -2
  41. package/dist/data-table/infer-filter.d.ts +4 -2
  42. package/dist/data-table/infer-filter.js +2 -0
  43. package/dist/data-table/infer-filter.js.map +1 -1
  44. package/dist/data-table/layered-filters.d.cts +3 -1
  45. package/dist/data-table/layered-filters.d.ts +3 -1
  46. package/dist/data-table/menu-targets.cjs +77 -0
  47. package/dist/data-table/menu-targets.cjs.map +1 -0
  48. package/dist/data-table/menu-targets.d.cts +108 -0
  49. package/dist/data-table/menu-targets.d.ts +108 -0
  50. package/dist/data-table/menu-targets.js +57 -0
  51. package/dist/data-table/menu-targets.js.map +1 -0
  52. package/dist/data-table/pagination.cjs.map +1 -1
  53. package/dist/data-table/pagination.js.map +1 -1
  54. package/dist/data-table/query-control.cjs.map +1 -1
  55. package/dist/data-table/query-control.d.cts +3 -1
  56. package/dist/data-table/query-control.d.ts +3 -1
  57. package/dist/data-table/query-control.js.map +1 -1
  58. package/dist/data-table/spreadsheet.cjs +61 -13
  59. package/dist/data-table/spreadsheet.cjs.map +1 -1
  60. package/dist/data-table/spreadsheet.d.cts +36 -1
  61. package/dist/data-table/spreadsheet.d.ts +36 -1
  62. package/dist/data-table/spreadsheet.js +61 -13
  63. package/dist/data-table/spreadsheet.js.map +1 -1
  64. package/dist/data-table/types.cjs.map +1 -1
  65. package/dist/data-table/types.d.cts +3 -1
  66. package/dist/data-table/types.d.ts +3 -1
  67. package/dist/data-table/url-state.d.cts +3 -1
  68. package/dist/data-table/url-state.d.ts +3 -1
  69. package/dist/data-table/uuid-cell.cjs.map +1 -1
  70. package/dist/data-table/uuid-cell.js.map +1 -1
  71. package/dist/data-table/xlsx.cjs.map +1 -1
  72. package/dist/data-table/xlsx.d.cts +3 -1
  73. package/dist/data-table/xlsx.d.ts +3 -1
  74. package/dist/data-table/xlsx.js.map +1 -1
  75. package/dist/field-formats/index.cjs +15 -0
  76. package/dist/field-formats/index.cjs.map +1 -1
  77. package/dist/field-formats/index.js +15 -0
  78. package/dist/field-formats/index.js.map +1 -1
  79. package/dist/{types-nlLCMiqd.d.ts → types-D9JBR6ZU.d.ts} +118 -5
  80. package/dist/{types-CmQrOz-T.d.cts → types-jQddSUnj.d.cts} +118 -5
  81. package/package.json +31 -1
@@ -4,7 +4,9 @@ import { AiVariant, AiCustomSource, CopyExportConfig } from './data-table/copy-t
4
4
  import { F as FieldFormatConfig } from './types-CJWU1Gae.js';
5
5
  import { GroupAggregateSpec, GroupOrder } from './data-table/grouping.js';
6
6
  import { CellPatch } from './data-table/fill.js';
7
+ import { ColumnFacets } from './data-table/facets.js';
7
8
  import { SpreadsheetIntent } from './data-table/spreadsheet.js';
9
+ import { DateColumnFilterValue } from './data-table/date-filter.js';
8
10
 
9
11
  type TableSearchRole = "id" | "name" | "description" | "other";
10
12
  interface TableSearchScope {
@@ -230,7 +232,7 @@ declare const stylePath: {
230
232
  declare function applyStylePath(style: TableStyle, path: StylePath, value: unknown): TableStyle;
231
233
 
232
234
  /** How a column's filter UI behaves. `auto` infers from sample values. */
233
- type ColumnFilterKind = "auto" | "text" | "select" | "boolean" | "number" | false;
235
+ type ColumnFilterKind = "auto" | "text" | "select" | "boolean" | "number" | "date" | false;
234
236
  type SortDirection = "asc" | "desc";
235
237
  /**
236
238
  * A compact boolean marker with the language people expect for a saved item.
@@ -504,7 +506,7 @@ type ColumnFilterValue = {
504
506
  min?: number | undefined;
505
507
  max?: number | undefined;
506
508
  negated?: boolean;
507
- };
509
+ } | DateColumnFilterValue;
508
510
  type ColumnFiltersState = Record<string, ColumnFilterValue | undefined>;
509
511
  interface SortState {
510
512
  id: string;
@@ -903,9 +905,49 @@ interface MatrxDataTableExpandedDetailConfig<T> {
903
905
  render: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;
904
906
  className?: string;
905
907
  }
906
- /** Opaque host-owned row menu descriptor. The package never interprets it. */
908
+ /**
909
+ * THE FOUR LEVELS of a right-click, as opaque host-owned descriptors.
910
+ *
911
+ * A spreadsheet's right-click menu is four menus, chosen by where the pointer
912
+ * was: the CELL, the ROW it sits in, the COLUMN it sits under, and — when the
913
+ * click lands inside an extended range — the SELECTION. The canonical table
914
+ * used to expose exactly one of them, which is why every surface that wanted
915
+ * the other three forked the table.
916
+ *
917
+ * Each resolver is optional and each returns something the package never
918
+ * interprets; the host builds its menu from it. A level with no resolver here
919
+ * falls back to the host's own `createDefaultMenuContext`, so a table that
920
+ * declares nothing still gets all four through the platform's universal menu.
921
+ */
907
922
  interface MatrxDataTableContextMenuConfig<T> {
908
- resolveRowContext: (row: T, controls: MatrxDataTableRecordControls) => unknown;
923
+ resolveRowContext?: (row: T, controls: MatrxDataTableRecordControls) => unknown;
924
+ resolveCellContext?: (args: {
925
+ row: T;
926
+ rowId: string;
927
+ columnId: string;
928
+ columnLabel: string;
929
+ value: unknown;
930
+ /** The cell's value as text, for the menu's own Copy. */
931
+ text: string;
932
+ controls: MatrxDataTableRecordControls;
933
+ }) => unknown;
934
+ resolveColumnContext?: (args: {
935
+ columnId: string;
936
+ columnLabel: string;
937
+ /** Every rendered row's value for this column, in visual order. */
938
+ values: unknown[];
939
+ }) => unknown;
940
+ resolveSelectionContext?: (args: {
941
+ rowIds: string[];
942
+ columnIds: string[];
943
+ /** The selected rectangle as an Excel/Sheets-compatible TSV block. */
944
+ tsv: string;
945
+ cellCount: number;
946
+ }) => unknown;
947
+ resolveTableContext?: (args: {
948
+ rowCount: number;
949
+ columnIds: string[];
950
+ }) => unknown;
909
951
  }
910
952
  interface MatrxDataTableWindowConfig<T> {
911
953
  /** Window title. */
@@ -962,6 +1004,24 @@ interface MatrxDataTableEditConfig<T> {
962
1004
  autoSave?: boolean;
963
1005
  /** Optional cancel hook (draft already discarded). */
964
1006
  onCancel?: () => void;
1007
+ /**
1008
+ * Judge a value the person MEANT to write, before it enters the draft.
1009
+ *
1010
+ * Return a sentence to REFUSE it: the editor stays open, the value is not
1011
+ * taken, and the sentence is shown IN THE CELL, where the person is standing.
1012
+ * Return undefined to accept. Excel's posture, and the reason is the product —
1013
+ * "Amount must be at least 0" is a thing a person can act on; a silent revert
1014
+ * is not.
1015
+ *
1016
+ * It never judges what is already stored: a value that predates the rule is
1017
+ * legal, is never rewritten, and is the point of declaring a rule at all.
1018
+ */
1019
+ validate?: ((args: {
1020
+ row: T;
1021
+ rowId: string;
1022
+ columnId: string;
1023
+ value: unknown;
1024
+ }) => string | undefined) | undefined;
965
1025
  }
966
1026
  interface MatrxDataTableHierarchyConfig<T> {
967
1027
  /** Complete hierarchy when `data` is only the current controlled page. */
@@ -1195,6 +1255,57 @@ interface MatrxDataTableSpreadsheetConfig<T> {
1195
1255
  undoDepth?: number | undefined;
1196
1256
  /** Says what just happened, and why something did not. */
1197
1257
  notify?: ((message: string) => void) | undefined;
1258
+ /**
1259
+ * Judge ONE value before it is written, for a paste, a fill or a clear.
1260
+ *
1261
+ * Return a sentence to REFUSE it — the cell is left alone and the sentence is
1262
+ * what the person is told. Return undefined to accept. This is the same rule
1263
+ * the inline editor enforces (`edit.validate`), asked in the one other place
1264
+ * a value can enter a cell, because a rule a paste can walk around is not a
1265
+ * rule.
1266
+ */
1267
+ validateCell?: ((args: {
1268
+ rowId: string;
1269
+ columnId: string;
1270
+ value: unknown;
1271
+ }) => string | undefined) | undefined;
1272
+ }
1273
+ /**
1274
+ * THE VALUES A COLUMN HOLDS, with a count beside each one.
1275
+ *
1276
+ * A filter that only offers "Contains…" asks the reader to already know what is
1277
+ * in the column. The checklist tells them, and the counts are what make it
1278
+ * usable: "Blocked 12" is a decision, "Blocked" is a guess.
1279
+ *
1280
+ * THE HONESTY RULE: counts are computed in the browser ONLY when the browser
1281
+ * holds every row they describe. Otherwise `source` is asked — the database
1282
+ * counts over the whole column — and if there is no source, the popover SAYS
1283
+ * the counts cover only the loaded rows. A partial count is never printed as if
1284
+ * it were the whole truth.
1285
+ */
1286
+ interface MatrxDataTableFacetsConfig<T> {
1287
+ enabled?: boolean | undefined;
1288
+ /**
1289
+ * Database-computed values and counts for one column. Called only when the
1290
+ * rows in the browser do not cover `totalRows` — local-data-first is the same
1291
+ * rule for every source. Return null (or throw) and the popover says so and
1292
+ * falls back to matching text.
1293
+ */
1294
+ source?: ((args: {
1295
+ columnId: string;
1296
+ search: string;
1297
+ limit: number;
1298
+ }) => Promise<ColumnFacets | null>) | undefined;
1299
+ /**
1300
+ * Rows the whole table holds after the active search. This is how the table
1301
+ * knows whether the rows it has are all of them. Omit it and the table treats
1302
+ * its own rows as a partial answer and says so.
1303
+ */
1304
+ totalRows?: number | undefined;
1305
+ /** Most values to list. Default 200, hard ceiling 500. */
1306
+ limit?: number | undefined;
1307
+ /** Reads a cell for counting. Defaults to the column's own filter accessor. */
1308
+ readCell?: ((row: T, columnId: string) => unknown) | undefined;
1198
1309
  }
1199
1310
  interface MatrxDataTableProps<T> {
1200
1311
  data: T[];
@@ -1340,6 +1451,8 @@ interface MatrxDataTableProps<T> {
1340
1451
  coverage?: MatrxDataTableCoverageConfig;
1341
1452
  /** Range selection, Excel paste, fill handle, fill-down, undo. Opt-in. */
1342
1453
  spreadsheet?: MatrxDataTableSpreadsheetConfig<T>;
1454
+ /** Real values with their counts in every column filter popover. */
1455
+ facets?: MatrxDataTableFacetsConfig<T>;
1343
1456
  /**
1344
1457
  * Explicit body row height in px. Overrides the density default. Use it when
1345
1458
  * a saved view remembers a row height the person chose.
@@ -1410,4 +1523,4 @@ interface MatrxDataTableProps<T> {
1410
1523
  onRowOpen?: (row: T) => void;
1411
1524
  }
1412
1525
 
1413
- export { type SortDirection as $, type AnyOfColumnSearch as A, BOOLEAN_TRUE_COLOR as B, type ColumnFiltersState as C, type MatrxDataTableGroupingConfig as D, EMPTY_TABLE_STYLE as E, type MatrxDataTableHierarchyConfig as F, type MatrxDataTableHierarchyMove as G, type MatrxDataTableMobileCardControls as H, type MatrxDataTableQueryControl as I, type MatrxDataTableSelectionConfig as J, type MatrxDataTableSourceProcessing as K, type LayeredFilterRule as L, type MatrxColumnDef as M, type MatrxDataTableSpreadsheetConfig as N, type MatrxDataTableStyleConfig as O, type MatrxDataTableToolbar as P, type MatrxDataTableUrlStateConfig as Q, type MatrxDataTableVirtualizeConfig as R, type SortState as S, type TableSearchMatchMode as T, type MatrxDataTableWindowConfig as U, type MatrxTablePagination as V, OPS_WITH_VALUE as W, ROW_TINT_CLASS as X, STYLE_COLORS as Y, STYLE_COLOR_LABELS as Z, SWATCH_CLASS as _, type ColumnFilterValue as a, type StyleColor as a0, type StylePath as a1, type StyleTarget as a2, TABLE_STYLE_METADATA_KEY as a3, TABLE_STYLE_VERSION as a4, type TableRankedSearchOptions as a5, type TableSearchRole as a6, type TableSearchScope as a7, type TableStyle as a8, type TableViewQuery as a9, layeredFilterNeedsValue as aA, layeredFilterRuleSummary as aB, operatorsForLayeredField as aC, type TextFilterMode as aa, type ToolbarFacet as ab, applyStylePath as ac, colorForChoice as ad, evaluateRule as ae, inferTableSearchRole as af, isStyleColor as ag, parseTableStyle as ah, rankTableSearchRows as ai, resolveCellColor as aj, resolveRowColor as ak, resolveTableSearchScopes as al, stylePath as am, tableStyleFromMetadata as an, tableStyleIsEmpty as ao, LAYERED_FILTER_OPERATORS as ap, LAYERED_FILTER_OPERATOR_LABELS as aq, type LayeredFilterField as ar, type LayeredFilterOperator as as, columnFiltersToLayeredRules as at, completeLayeredFilterRules as au, decodeLayeredFilterRules as av, encodeLayeredFilterRules as aw, isCompleteLayeredFilterRule as ax, isLayeredFilterOperator as ay, layeredFilterMatchesValue as az, type TableSavedViewsProps as b, type MatrxDataTableRecordControls as c, type MatrxDataTableDensity as d, type MatrxDataTableQueryState as e, type ColumnFilterKind as f, type MatrxDataTableCopyConfig as g, type MatrxDataTableProps as h, type TableViewSnapshot as i, type ColumnMarker as j, CELL_TINT_CLASS as k, COLOR_RULE_OPS as l, COLOR_RULE_OP_LABELS as m, type CellEditType as n, type CellEditsMap as o, type ChoiceColorLookup as p, type ColorBy as q, type ColorRule as r, type ColorRuleOp as s, type MatrxDataTableContextMenuConfig as t, type MatrxDataTableCoverageConfig as u, type MatrxDataTableDetailConfig as v, type MatrxDataTableEditConfig as w, type MatrxDataTableEmptyState as x, type MatrxDataTableExpandedDetailConfig as y, type MatrxDataTableFilterUi as z };
1526
+ export { SWATCH_CLASS as $, type AnyOfColumnSearch as A, BOOLEAN_TRUE_COLOR as B, type ColumnFiltersState as C, type MatrxDataTableFilterUi as D, EMPTY_TABLE_STYLE as E, type MatrxDataTableGroupingConfig as F, type MatrxDataTableHierarchyConfig as G, type MatrxDataTableHierarchyMove as H, type MatrxDataTableMobileCardControls as I, type MatrxDataTableQueryControl as J, type MatrxDataTableSelectionConfig as K, type LayeredFilterRule as L, type MatrxColumnDef as M, type MatrxDataTableSourceProcessing as N, type MatrxDataTableSpreadsheetConfig as O, type MatrxDataTableStyleConfig as P, type MatrxDataTableToolbar as Q, type MatrxDataTableUrlStateConfig as R, type SortState as S, type TableSearchMatchMode as T, type MatrxDataTableVirtualizeConfig as U, type MatrxDataTableWindowConfig as V, type MatrxTablePagination as W, OPS_WITH_VALUE as X, ROW_TINT_CLASS as Y, STYLE_COLORS as Z, STYLE_COLOR_LABELS as _, type ColumnFilterValue as a, type SortDirection as a0, type StyleColor as a1, type StylePath as a2, type StyleTarget as a3, TABLE_STYLE_METADATA_KEY as a4, TABLE_STYLE_VERSION as a5, type TableRankedSearchOptions as a6, type TableSearchRole as a7, type TableSearchScope as a8, type TableStyle as a9, layeredFilterMatchesValue as aA, layeredFilterNeedsValue as aB, layeredFilterRuleSummary as aC, operatorsForLayeredField as aD, type TableViewQuery as aa, type TextFilterMode as ab, type ToolbarFacet as ac, applyStylePath as ad, colorForChoice as ae, evaluateRule as af, inferTableSearchRole as ag, isStyleColor as ah, parseTableStyle as ai, rankTableSearchRows as aj, resolveCellColor as ak, resolveRowColor as al, resolveTableSearchScopes as am, stylePath as an, tableStyleFromMetadata as ao, tableStyleIsEmpty as ap, LAYERED_FILTER_OPERATORS as aq, LAYERED_FILTER_OPERATOR_LABELS as ar, type LayeredFilterField as as, type LayeredFilterOperator as at, columnFiltersToLayeredRules as au, completeLayeredFilterRules as av, decodeLayeredFilterRules as aw, encodeLayeredFilterRules as ax, isCompleteLayeredFilterRule as ay, isLayeredFilterOperator as az, type TableSavedViewsProps as b, type MatrxDataTableDensity as c, type MatrxDataTableRecordControls as d, type MatrxDataTableQueryState as e, type ColumnFilterKind as f, type MatrxDataTableCopyConfig as g, type MatrxDataTableProps as h, type TableViewSnapshot as i, type ColumnMarker as j, CELL_TINT_CLASS as k, COLOR_RULE_OPS as l, COLOR_RULE_OP_LABELS as m, type CellEditType as n, type CellEditsMap as o, type ChoiceColorLookup as p, type ColorBy as q, type ColorRule as r, type ColorRuleOp as s, type MatrxDataTableContextMenuConfig as t, type MatrxDataTableCoverageConfig as u, type MatrxDataTableDetailConfig as v, type MatrxDataTableEditConfig as w, type MatrxDataTableEmptyState as x, type MatrxDataTableExpandedDetailConfig as y, type MatrxDataTableFacetsConfig as z };
@@ -4,7 +4,9 @@ import { AiVariant, AiCustomSource, CopyExportConfig } from './data-table/copy-t
4
4
  import { F as FieldFormatConfig } from './types-CJWU1Gae.cjs';
5
5
  import { GroupAggregateSpec, GroupOrder } from './data-table/grouping.cjs';
6
6
  import { CellPatch } from './data-table/fill.cjs';
7
+ import { ColumnFacets } from './data-table/facets.cjs';
7
8
  import { SpreadsheetIntent } from './data-table/spreadsheet.cjs';
9
+ import { DateColumnFilterValue } from './data-table/date-filter.cjs';
8
10
 
9
11
  type TableSearchRole = "id" | "name" | "description" | "other";
10
12
  interface TableSearchScope {
@@ -230,7 +232,7 @@ declare const stylePath: {
230
232
  declare function applyStylePath(style: TableStyle, path: StylePath, value: unknown): TableStyle;
231
233
 
232
234
  /** How a column's filter UI behaves. `auto` infers from sample values. */
233
- type ColumnFilterKind = "auto" | "text" | "select" | "boolean" | "number" | false;
235
+ type ColumnFilterKind = "auto" | "text" | "select" | "boolean" | "number" | "date" | false;
234
236
  type SortDirection = "asc" | "desc";
235
237
  /**
236
238
  * A compact boolean marker with the language people expect for a saved item.
@@ -504,7 +506,7 @@ type ColumnFilterValue = {
504
506
  min?: number | undefined;
505
507
  max?: number | undefined;
506
508
  negated?: boolean;
507
- };
509
+ } | DateColumnFilterValue;
508
510
  type ColumnFiltersState = Record<string, ColumnFilterValue | undefined>;
509
511
  interface SortState {
510
512
  id: string;
@@ -903,9 +905,49 @@ interface MatrxDataTableExpandedDetailConfig<T> {
903
905
  render: (row: T, controls: MatrxDataTableRecordControls) => ReactNode;
904
906
  className?: string;
905
907
  }
906
- /** Opaque host-owned row menu descriptor. The package never interprets it. */
908
+ /**
909
+ * THE FOUR LEVELS of a right-click, as opaque host-owned descriptors.
910
+ *
911
+ * A spreadsheet's right-click menu is four menus, chosen by where the pointer
912
+ * was: the CELL, the ROW it sits in, the COLUMN it sits under, and — when the
913
+ * click lands inside an extended range — the SELECTION. The canonical table
914
+ * used to expose exactly one of them, which is why every surface that wanted
915
+ * the other three forked the table.
916
+ *
917
+ * Each resolver is optional and each returns something the package never
918
+ * interprets; the host builds its menu from it. A level with no resolver here
919
+ * falls back to the host's own `createDefaultMenuContext`, so a table that
920
+ * declares nothing still gets all four through the platform's universal menu.
921
+ */
907
922
  interface MatrxDataTableContextMenuConfig<T> {
908
- resolveRowContext: (row: T, controls: MatrxDataTableRecordControls) => unknown;
923
+ resolveRowContext?: (row: T, controls: MatrxDataTableRecordControls) => unknown;
924
+ resolveCellContext?: (args: {
925
+ row: T;
926
+ rowId: string;
927
+ columnId: string;
928
+ columnLabel: string;
929
+ value: unknown;
930
+ /** The cell's value as text, for the menu's own Copy. */
931
+ text: string;
932
+ controls: MatrxDataTableRecordControls;
933
+ }) => unknown;
934
+ resolveColumnContext?: (args: {
935
+ columnId: string;
936
+ columnLabel: string;
937
+ /** Every rendered row's value for this column, in visual order. */
938
+ values: unknown[];
939
+ }) => unknown;
940
+ resolveSelectionContext?: (args: {
941
+ rowIds: string[];
942
+ columnIds: string[];
943
+ /** The selected rectangle as an Excel/Sheets-compatible TSV block. */
944
+ tsv: string;
945
+ cellCount: number;
946
+ }) => unknown;
947
+ resolveTableContext?: (args: {
948
+ rowCount: number;
949
+ columnIds: string[];
950
+ }) => unknown;
909
951
  }
910
952
  interface MatrxDataTableWindowConfig<T> {
911
953
  /** Window title. */
@@ -962,6 +1004,24 @@ interface MatrxDataTableEditConfig<T> {
962
1004
  autoSave?: boolean;
963
1005
  /** Optional cancel hook (draft already discarded). */
964
1006
  onCancel?: () => void;
1007
+ /**
1008
+ * Judge a value the person MEANT to write, before it enters the draft.
1009
+ *
1010
+ * Return a sentence to REFUSE it: the editor stays open, the value is not
1011
+ * taken, and the sentence is shown IN THE CELL, where the person is standing.
1012
+ * Return undefined to accept. Excel's posture, and the reason is the product —
1013
+ * "Amount must be at least 0" is a thing a person can act on; a silent revert
1014
+ * is not.
1015
+ *
1016
+ * It never judges what is already stored: a value that predates the rule is
1017
+ * legal, is never rewritten, and is the point of declaring a rule at all.
1018
+ */
1019
+ validate?: ((args: {
1020
+ row: T;
1021
+ rowId: string;
1022
+ columnId: string;
1023
+ value: unknown;
1024
+ }) => string | undefined) | undefined;
965
1025
  }
966
1026
  interface MatrxDataTableHierarchyConfig<T> {
967
1027
  /** Complete hierarchy when `data` is only the current controlled page. */
@@ -1195,6 +1255,57 @@ interface MatrxDataTableSpreadsheetConfig<T> {
1195
1255
  undoDepth?: number | undefined;
1196
1256
  /** Says what just happened, and why something did not. */
1197
1257
  notify?: ((message: string) => void) | undefined;
1258
+ /**
1259
+ * Judge ONE value before it is written, for a paste, a fill or a clear.
1260
+ *
1261
+ * Return a sentence to REFUSE it — the cell is left alone and the sentence is
1262
+ * what the person is told. Return undefined to accept. This is the same rule
1263
+ * the inline editor enforces (`edit.validate`), asked in the one other place
1264
+ * a value can enter a cell, because a rule a paste can walk around is not a
1265
+ * rule.
1266
+ */
1267
+ validateCell?: ((args: {
1268
+ rowId: string;
1269
+ columnId: string;
1270
+ value: unknown;
1271
+ }) => string | undefined) | undefined;
1272
+ }
1273
+ /**
1274
+ * THE VALUES A COLUMN HOLDS, with a count beside each one.
1275
+ *
1276
+ * A filter that only offers "Contains…" asks the reader to already know what is
1277
+ * in the column. The checklist tells them, and the counts are what make it
1278
+ * usable: "Blocked 12" is a decision, "Blocked" is a guess.
1279
+ *
1280
+ * THE HONESTY RULE: counts are computed in the browser ONLY when the browser
1281
+ * holds every row they describe. Otherwise `source` is asked — the database
1282
+ * counts over the whole column — and if there is no source, the popover SAYS
1283
+ * the counts cover only the loaded rows. A partial count is never printed as if
1284
+ * it were the whole truth.
1285
+ */
1286
+ interface MatrxDataTableFacetsConfig<T> {
1287
+ enabled?: boolean | undefined;
1288
+ /**
1289
+ * Database-computed values and counts for one column. Called only when the
1290
+ * rows in the browser do not cover `totalRows` — local-data-first is the same
1291
+ * rule for every source. Return null (or throw) and the popover says so and
1292
+ * falls back to matching text.
1293
+ */
1294
+ source?: ((args: {
1295
+ columnId: string;
1296
+ search: string;
1297
+ limit: number;
1298
+ }) => Promise<ColumnFacets | null>) | undefined;
1299
+ /**
1300
+ * Rows the whole table holds after the active search. This is how the table
1301
+ * knows whether the rows it has are all of them. Omit it and the table treats
1302
+ * its own rows as a partial answer and says so.
1303
+ */
1304
+ totalRows?: number | undefined;
1305
+ /** Most values to list. Default 200, hard ceiling 500. */
1306
+ limit?: number | undefined;
1307
+ /** Reads a cell for counting. Defaults to the column's own filter accessor. */
1308
+ readCell?: ((row: T, columnId: string) => unknown) | undefined;
1198
1309
  }
1199
1310
  interface MatrxDataTableProps<T> {
1200
1311
  data: T[];
@@ -1340,6 +1451,8 @@ interface MatrxDataTableProps<T> {
1340
1451
  coverage?: MatrxDataTableCoverageConfig;
1341
1452
  /** Range selection, Excel paste, fill handle, fill-down, undo. Opt-in. */
1342
1453
  spreadsheet?: MatrxDataTableSpreadsheetConfig<T>;
1454
+ /** Real values with their counts in every column filter popover. */
1455
+ facets?: MatrxDataTableFacetsConfig<T>;
1343
1456
  /**
1344
1457
  * Explicit body row height in px. Overrides the density default. Use it when
1345
1458
  * a saved view remembers a row height the person chose.
@@ -1410,4 +1523,4 @@ interface MatrxDataTableProps<T> {
1410
1523
  onRowOpen?: (row: T) => void;
1411
1524
  }
1412
1525
 
1413
- export { type SortDirection as $, type AnyOfColumnSearch as A, BOOLEAN_TRUE_COLOR as B, type ColumnFiltersState as C, type MatrxDataTableGroupingConfig as D, EMPTY_TABLE_STYLE as E, type MatrxDataTableHierarchyConfig as F, type MatrxDataTableHierarchyMove as G, type MatrxDataTableMobileCardControls as H, type MatrxDataTableQueryControl as I, type MatrxDataTableSelectionConfig as J, type MatrxDataTableSourceProcessing as K, type LayeredFilterRule as L, type MatrxColumnDef as M, type MatrxDataTableSpreadsheetConfig as N, type MatrxDataTableStyleConfig as O, type MatrxDataTableToolbar as P, type MatrxDataTableUrlStateConfig as Q, type MatrxDataTableVirtualizeConfig as R, type SortState as S, type TableSearchMatchMode as T, type MatrxDataTableWindowConfig as U, type MatrxTablePagination as V, OPS_WITH_VALUE as W, ROW_TINT_CLASS as X, STYLE_COLORS as Y, STYLE_COLOR_LABELS as Z, SWATCH_CLASS as _, type ColumnFilterValue as a, type StyleColor as a0, type StylePath as a1, type StyleTarget as a2, TABLE_STYLE_METADATA_KEY as a3, TABLE_STYLE_VERSION as a4, type TableRankedSearchOptions as a5, type TableSearchRole as a6, type TableSearchScope as a7, type TableStyle as a8, type TableViewQuery as a9, layeredFilterNeedsValue as aA, layeredFilterRuleSummary as aB, operatorsForLayeredField as aC, type TextFilterMode as aa, type ToolbarFacet as ab, applyStylePath as ac, colorForChoice as ad, evaluateRule as ae, inferTableSearchRole as af, isStyleColor as ag, parseTableStyle as ah, rankTableSearchRows as ai, resolveCellColor as aj, resolveRowColor as ak, resolveTableSearchScopes as al, stylePath as am, tableStyleFromMetadata as an, tableStyleIsEmpty as ao, LAYERED_FILTER_OPERATORS as ap, LAYERED_FILTER_OPERATOR_LABELS as aq, type LayeredFilterField as ar, type LayeredFilterOperator as as, columnFiltersToLayeredRules as at, completeLayeredFilterRules as au, decodeLayeredFilterRules as av, encodeLayeredFilterRules as aw, isCompleteLayeredFilterRule as ax, isLayeredFilterOperator as ay, layeredFilterMatchesValue as az, type TableSavedViewsProps as b, type MatrxDataTableRecordControls as c, type MatrxDataTableDensity as d, type MatrxDataTableQueryState as e, type ColumnFilterKind as f, type MatrxDataTableCopyConfig as g, type MatrxDataTableProps as h, type TableViewSnapshot as i, type ColumnMarker as j, CELL_TINT_CLASS as k, COLOR_RULE_OPS as l, COLOR_RULE_OP_LABELS as m, type CellEditType as n, type CellEditsMap as o, type ChoiceColorLookup as p, type ColorBy as q, type ColorRule as r, type ColorRuleOp as s, type MatrxDataTableContextMenuConfig as t, type MatrxDataTableCoverageConfig as u, type MatrxDataTableDetailConfig as v, type MatrxDataTableEditConfig as w, type MatrxDataTableEmptyState as x, type MatrxDataTableExpandedDetailConfig as y, type MatrxDataTableFilterUi as z };
1526
+ export { SWATCH_CLASS as $, type AnyOfColumnSearch as A, BOOLEAN_TRUE_COLOR as B, type ColumnFiltersState as C, type MatrxDataTableFilterUi as D, EMPTY_TABLE_STYLE as E, type MatrxDataTableGroupingConfig as F, type MatrxDataTableHierarchyConfig as G, type MatrxDataTableHierarchyMove as H, type MatrxDataTableMobileCardControls as I, type MatrxDataTableQueryControl as J, type MatrxDataTableSelectionConfig as K, type LayeredFilterRule as L, type MatrxColumnDef as M, type MatrxDataTableSourceProcessing as N, type MatrxDataTableSpreadsheetConfig as O, type MatrxDataTableStyleConfig as P, type MatrxDataTableToolbar as Q, type MatrxDataTableUrlStateConfig as R, type SortState as S, type TableSearchMatchMode as T, type MatrxDataTableVirtualizeConfig as U, type MatrxDataTableWindowConfig as V, type MatrxTablePagination as W, OPS_WITH_VALUE as X, ROW_TINT_CLASS as Y, STYLE_COLORS as Z, STYLE_COLOR_LABELS as _, type ColumnFilterValue as a, type SortDirection as a0, type StyleColor as a1, type StylePath as a2, type StyleTarget as a3, TABLE_STYLE_METADATA_KEY as a4, TABLE_STYLE_VERSION as a5, type TableRankedSearchOptions as a6, type TableSearchRole as a7, type TableSearchScope as a8, type TableStyle as a9, layeredFilterMatchesValue as aA, layeredFilterNeedsValue as aB, layeredFilterRuleSummary as aC, operatorsForLayeredField as aD, type TableViewQuery as aa, type TextFilterMode as ab, type ToolbarFacet as ac, applyStylePath as ad, colorForChoice as ae, evaluateRule as af, inferTableSearchRole as ag, isStyleColor as ah, parseTableStyle as ai, rankTableSearchRows as aj, resolveCellColor as ak, resolveRowColor as al, resolveTableSearchScopes as am, stylePath as an, tableStyleFromMetadata as ao, tableStyleIsEmpty as ap, LAYERED_FILTER_OPERATORS as aq, LAYERED_FILTER_OPERATOR_LABELS as ar, type LayeredFilterField as as, type LayeredFilterOperator as at, columnFiltersToLayeredRules as au, completeLayeredFilterRules as av, decodeLayeredFilterRules as aw, encodeLayeredFilterRules as ax, isCompleteLayeredFilterRule as ay, isLayeredFilterOperator as az, type TableSavedViewsProps as b, type MatrxDataTableDensity as c, type MatrxDataTableRecordControls as d, type MatrxDataTableQueryState as e, type ColumnFilterKind as f, type MatrxDataTableCopyConfig as g, type MatrxDataTableProps as h, type TableViewSnapshot as i, type ColumnMarker as j, CELL_TINT_CLASS as k, COLOR_RULE_OPS as l, COLOR_RULE_OP_LABELS as m, type CellEditType as n, type CellEditsMap as o, type ChoiceColorLookup as p, type ColorBy as q, type ColorRule as r, type ColorRuleOp as s, type MatrxDataTableContextMenuConfig as t, type MatrxDataTableCoverageConfig as u, type MatrxDataTableDetailConfig as v, type MatrxDataTableEditConfig as w, type MatrxDataTableEmptyState as x, type MatrxDataTableExpandedDetailConfig as y, type MatrxDataTableFacetsConfig as z };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ai-matrx/design-system",
3
- "version": "0.25.0",
3
+ "version": "0.27.0",
4
4
  "description": "AI Matrx semantic React primitives shared across Vite, Next.js, desktop, and customer-built applications.",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -228,6 +228,16 @@
228
228
  "default": "./dist/data-table/infer-filter.cjs"
229
229
  }
230
230
  },
231
+ "./data-table/date-filter": {
232
+ "import": {
233
+ "types": "./dist/data-table/date-filter.d.ts",
234
+ "default": "./dist/data-table/date-filter.js"
235
+ },
236
+ "require": {
237
+ "types": "./dist/data-table/date-filter.d.cts",
238
+ "default": "./dist/data-table/date-filter.cjs"
239
+ }
240
+ },
231
241
  "./data-table/scroll-pagination": {
232
242
  "import": {
233
243
  "types": "./dist/data-table/scroll-pagination.d.ts",
@@ -338,6 +348,26 @@
338
348
  "default": "./dist/data-table/spreadsheet.cjs"
339
349
  }
340
350
  },
351
+ "./data-table/facets": {
352
+ "import": {
353
+ "types": "./dist/data-table/facets.d.ts",
354
+ "default": "./dist/data-table/facets.js"
355
+ },
356
+ "require": {
357
+ "types": "./dist/data-table/facets.d.cts",
358
+ "default": "./dist/data-table/facets.cjs"
359
+ }
360
+ },
361
+ "./data-table/menu-targets": {
362
+ "import": {
363
+ "types": "./dist/data-table/menu-targets.d.ts",
364
+ "default": "./dist/data-table/menu-targets.js"
365
+ },
366
+ "require": {
367
+ "types": "./dist/data-table/menu-targets.d.cts",
368
+ "default": "./dist/data-table/menu-targets.cjs"
369
+ }
370
+ },
341
371
  "./package.json": "./package.json"
342
372
  },
343
373
  "dependencies": {