@coldsmirk/ledger-mantine 0.3.0 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -52,30 +52,74 @@ let _mantine_dates = require("@mantine/dates");
52
52
  */
53
53
  const [DataTableProvider, useDataTableContext] = (0, _mantine_core.createSafeContext)("DataTable parts must be rendered inside <DataTable>");
54
54
  //#endregion
55
+ //#region src/size.ts
56
+ const SIZES = {
57
+ xs: {
58
+ verticalSpacing: 5,
59
+ horizontalSpacing: 8,
60
+ rowHeight: 31,
61
+ control: "xs",
62
+ glyph: 12,
63
+ injectedWidth: 36
64
+ },
65
+ sm: {
66
+ verticalSpacing: 7,
67
+ horizontalSpacing: 10,
68
+ rowHeight: 37,
69
+ control: "xs",
70
+ glyph: 14,
71
+ injectedWidth: 40
72
+ },
73
+ md: {
74
+ verticalSpacing: 8,
75
+ horizontalSpacing: 12,
76
+ rowHeight: 43,
77
+ control: "sm",
78
+ glyph: 16,
79
+ injectedWidth: 48
80
+ },
81
+ lg: {
82
+ verticalSpacing: 10,
83
+ horizontalSpacing: 16,
84
+ rowHeight: 51,
85
+ control: "md",
86
+ glyph: 18,
87
+ injectedWidth: 62
88
+ },
89
+ xl: {
90
+ verticalSpacing: 14,
91
+ horizontalSpacing: 20,
92
+ rowHeight: 61,
93
+ control: "lg",
94
+ glyph: 20,
95
+ injectedWidth: 76
96
+ }
97
+ };
98
+ //#endregion
55
99
  //#region src/expander.tsx
56
100
  /**
57
101
  * The injected expander column: a per-row chevron (detail panels and sub-row trees share it)
58
102
  * and an expand-all header affordance for trees. Clicks never reach `onRowClick`.
59
103
  */
60
104
  function ExpanderHeaderCell({ table }) {
61
- const { labels, icons, expansion } = useDataTableContext();
105
+ const { labels, icons, expansion, size } = useDataTableContext();
62
106
  if (!table.options.getSubRows) return null;
63
107
  const allExpanded = table.getIsAllRowsExpanded();
64
108
  const canSomeExpand = table.getCanSomeRowsExpand();
65
109
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.ActionIcon, {
66
110
  "aria-label": allExpanded ? labels.collapseAll : labels.expandAll,
67
111
  "data-expanded": allExpanded || void 0,
68
- size: "sm",
112
+ size: SIZES[size].control,
69
113
  variant: "subtle",
70
114
  onClick: (event) => {
71
115
  event.stopPropagation();
72
116
  expansion?.toggleAll(!allExpanded, canSomeExpand);
73
117
  },
74
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.expandRow, {})
118
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.expandRow, { size: SIZES[size].glyph })
75
119
  });
76
120
  }
77
121
  function ExpanderCell({ row }) {
78
- const { labels, icons, expansion } = useDataTableContext();
122
+ const { labels, icons, expansion, size } = useDataTableContext();
79
123
  const canExpand = row.getCanExpand();
80
124
  if (!canExpand) return null;
81
125
  const expanded = row.getIsExpanded();
@@ -83,13 +127,13 @@ function ExpanderCell({ row }) {
83
127
  "aria-expanded": expanded,
84
128
  "aria-label": expanded ? labels.collapseRow : labels.expandRow,
85
129
  "data-expanded": expanded || void 0,
86
- size: "sm",
130
+ size: SIZES[size].control,
87
131
  variant: "subtle",
88
132
  onClick: (event) => {
89
133
  event.stopPropagation();
90
134
  expansion?.toggle(row.id, expanded, canExpand);
91
135
  },
92
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.expandRow, {})
136
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.expandRow, { size: SIZES[size].glyph })
93
137
  });
94
138
  }
95
139
  //#endregion
@@ -516,7 +560,7 @@ function RowReorderOverlay({ session }) {
516
560
  * why (docs/rows.md#row-ordering).
517
561
  */
518
562
  function RowDragCell({ row, table }) {
519
- const { labels, icons, rowReorderKeyboard } = useDataTableContext();
563
+ const { labels, icons, rowReorderKeyboard, size } = useDataTableContext();
520
564
  const orderable = table.options.meta?.ledger?.rowOrdering.orderable === true;
521
565
  const pinned = table.options.enableRowPinning === true && row.getIsPinned() !== false;
522
566
  const { ref, isDragSource } = (0, _dnd_kit_react.useDraggable)({
@@ -574,13 +618,13 @@ function RowDragCell({ row, table }) {
574
618
  "aria-label": labels.reorderRow,
575
619
  "aria-pressed": lifted || void 0,
576
620
  color: "gray",
577
- size: "sm",
621
+ size: SIZES[size].control,
578
622
  variant: "subtle",
579
623
  onBlur: () => {
580
624
  if (lifted) rowReorderKeyboard?.cancel();
581
625
  },
582
626
  onKeyDown: handleKeyDown,
583
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.reorderRow, { size: 14 })
627
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.reorderRow, { size: SIZES[size].glyph })
584
628
  })
585
629
  });
586
630
  }
@@ -597,7 +641,7 @@ function RowDragCell({ row, table }) {
597
641
  */
598
642
  function noop() {}
599
643
  function SelectionHeaderCell({ table }) {
600
- const { labels, selection } = useDataTableContext();
644
+ const { labels, selection, size } = useDataTableContext();
601
645
  if (table.options.enableMultiRowSelection === false) return null;
602
646
  const scope = table.options.meta?.ledger?.selectAllScope ?? "all";
603
647
  const allSelected = scope === "page" ? table.getIsAllPageRowsSelected() : table.getIsAllRowsSelected();
@@ -606,7 +650,7 @@ function SelectionHeaderCell({ table }) {
606
650
  "aria-label": labels.selectAllRows,
607
651
  checked: allSelected,
608
652
  indeterminate: !allSelected && someSelected,
609
- size: "xs",
653
+ size: SIZES[size].control,
610
654
  onChange: noop,
611
655
  onClick: (event) => {
612
656
  event.stopPropagation();
@@ -615,7 +659,7 @@ function SelectionHeaderCell({ table }) {
615
659
  });
616
660
  }
617
661
  function SelectionCell({ row }) {
618
- const { labels, instanceId, selection } = useDataTableContext();
662
+ const { labels, instanceId, selection, size } = useDataTableContext();
619
663
  const selected = row.getIsSelected();
620
664
  const select = (event) => {
621
665
  event.stopPropagation();
@@ -626,7 +670,7 @@ function SelectionCell({ row }) {
626
670
  checked: selected,
627
671
  disabled: !row.getCanSelect(),
628
672
  name: `${instanceId}-selection`,
629
- size: "xs",
673
+ size: SIZES[size].control,
630
674
  onChange: noop,
631
675
  onClick: select
632
676
  });
@@ -635,7 +679,7 @@ function SelectionCell({ row }) {
635
679
  checked: selected,
636
680
  disabled: !row.getCanSelect(),
637
681
  indeterminate: !selected && row.getIsSomeSelected(),
638
- size: "xs",
682
+ size: SIZES[size].control,
639
683
  onChange: noop,
640
684
  onClick: select
641
685
  });
@@ -687,9 +731,6 @@ function buildColumns({ columns, withRowDrag, withSelection, withExpander, rowDr
687
731
  const result = [];
688
732
  if (withRowDrag) result.push(injectedColumn({
689
733
  id: ROW_DRAG_COLUMN_ID,
690
- size: 36,
691
- minSize: 36,
692
- maxSize: 36,
693
734
  enableSorting: false,
694
735
  enableHiding: false,
695
736
  enableResizing: false,
@@ -704,9 +745,6 @@ function buildColumns({ columns, withRowDrag, withSelection, withExpander, rowDr
704
745
  }, rowDragColumn));
705
746
  if (withSelection) result.push(injectedColumn({
706
747
  id: SELECTION_COLUMN_ID,
707
- size: 40,
708
- minSize: 40,
709
- maxSize: 40,
710
748
  enableSorting: false,
711
749
  enableHiding: false,
712
750
  enableResizing: false,
@@ -718,9 +756,6 @@ function buildColumns({ columns, withRowDrag, withSelection, withExpander, rowDr
718
756
  }, selectionColumn));
719
757
  if (withExpander) result.push(injectedColumn({
720
758
  id: EXPANDER_COLUMN_ID,
721
- size: 36,
722
- minSize: 36,
723
- maxSize: 36,
724
759
  enableSorting: false,
725
760
  enableHiding: false,
726
761
  enableResizing: false,
@@ -1565,7 +1600,7 @@ const DEFAULT_PAGE_SIZE_OPTIONS = [
1565
1600
  50,
1566
1601
  100
1567
1602
  ];
1568
- function PaginationBarCore({ table, labels, pageSizeOptions, className, style }) {
1603
+ function PaginationBarCore({ table, labels, pageSizeOptions, size, className, style }) {
1569
1604
  const pageSizeLabelId = (0, react.useId)();
1570
1605
  const { pageIndex, pageSize } = table.atoms.pagination.get();
1571
1606
  const total = table.getRowCount();
@@ -1581,7 +1616,7 @@ function PaginationBarCore({ table, labels, pageSizeOptions, className, style })
1581
1616
  wrap: "wrap",
1582
1617
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Text, {
1583
1618
  c: "dimmed",
1584
- size: "sm",
1619
+ size,
1585
1620
  children: labels.paginationSummary(from, to, total)
1586
1621
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsxs)(_mantine_core.Group, {
1587
1622
  gap: "md",
@@ -1592,19 +1627,19 @@ function PaginationBarCore({ table, labels, pageSizeOptions, className, style })
1592
1627
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Text, {
1593
1628
  c: "dimmed",
1594
1629
  id: pageSizeLabelId,
1595
- size: "sm",
1630
+ size,
1596
1631
  children: labels.rowsPerPage
1597
1632
  }, "label"), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Select, {
1598
1633
  allowDeselect: false,
1599
1634
  "aria-labelledby": pageSizeLabelId,
1600
1635
  data: sizeOptions.map(String),
1601
- size: "xs",
1636
+ size: SIZES[size].control,
1602
1637
  value: String(pageSize),
1603
1638
  w: 84,
1604
1639
  onChange: (value) => value !== null && table.setPageSize(Number(value))
1605
1640
  })]
1606
1641
  }), /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Pagination, {
1607
- size: "sm",
1642
+ size: SIZES[size].control,
1608
1643
  total: pageCount,
1609
1644
  value: pageIndex + 1,
1610
1645
  onChange: (page) => table.setPageIndex(page - 1)
@@ -1616,26 +1651,28 @@ function PaginationBarCore({ table, labels, pageSizeOptions, className, style })
1616
1651
  * The built-in bar rendered by <DataTable> (context-styled).
1617
1652
  */
1618
1653
  function PaginationBar({ table, pageSizeOptions }) {
1619
- const { labels, getStyles } = useDataTableContext();
1654
+ const { labels, getStyles, size } = useDataTableContext();
1620
1655
  const { className, style } = getStyles("paginationBar");
1621
1656
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationBarCore, {
1622
1657
  className,
1623
1658
  labels,
1624
1659
  pageSizeOptions,
1660
+ size,
1625
1661
  style,
1626
1662
  table
1627
1663
  });
1628
1664
  }
1629
- const paginationDefaultProps = {};
1665
+ const paginationDefaultProps = { size: "sm" };
1630
1666
  /**
1631
1667
  * Standalone compound (`DataTable.Pagination`) — place it anywhere, theme it via defaultProps.
1632
1668
  */
1633
1669
  function DataTablePagination(props) {
1634
- const { table, pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS, labels, className, style } = (0, _mantine_core.useProps)("DataTablePagination", paginationDefaultProps, props);
1670
+ const { table, pageSizeOptions = DEFAULT_PAGE_SIZE_OPTIONS, labels, size, className, style } = (0, _mantine_core.useProps)("DataTablePagination", paginationDefaultProps, props);
1635
1671
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(PaginationBarCore, {
1636
1672
  className: (0, clsx.default)("ledger-pagination-bar", className),
1637
1673
  labels: resolveLabels(labels),
1638
1674
  pageSizeOptions,
1675
+ size,
1639
1676
  style,
1640
1677
  table
1641
1678
  });
@@ -1793,7 +1830,7 @@ function canEditCell(cell, row) {
1793
1830
  * commit, and the pending presentation around it.
1794
1831
  */
1795
1832
  function CellEditor({ cell }) {
1796
- const { labels, getStyles } = useDataTableContext();
1833
+ const { labels, getStyles, size } = useDataTableContext();
1797
1834
  const { table } = cell.getContext();
1798
1835
  const editing = table.options.meta?.ledger?.editing;
1799
1836
  const normalized = normalizeEdit(cell.column.columnDef.meta?.edit);
@@ -1842,7 +1879,8 @@ function CellEditor({ cell }) {
1842
1879
  pending,
1843
1880
  mode: "cell",
1844
1881
  autoFocus: true,
1845
- label: labels.editColumn(columnHeaderText(cell.column))
1882
+ label: labels.editColumn(columnHeaderText(cell.column)),
1883
+ size: SIZES[size].control
1846
1884
  });
1847
1885
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1848
1886
  "aria-busy": pending || void 0,
@@ -1864,7 +1902,7 @@ function CellEditor({ cell }) {
1864
1902
  * a virtualized unmount), blur never commits, and Enter/Escape commit or cancel the whole row.
1865
1903
  */
1866
1904
  function RowCellEditor({ cell }) {
1867
- const { labels, getStyles } = useDataTableContext();
1905
+ const { labels, getStyles, size } = useDataTableContext();
1868
1906
  const { table } = cell.getContext();
1869
1907
  const editing = table.options.meta?.ledger?.editing;
1870
1908
  const rowApi = editing?.row;
@@ -1922,7 +1960,8 @@ function RowCellEditor({ cell }) {
1922
1960
  },
1923
1961
  error: editError,
1924
1962
  pending,
1925
- label
1963
+ label,
1964
+ size: SIZES[size].control
1926
1965
  }) : normalized.render({
1927
1966
  row: cell.row,
1928
1967
  column: cell.column,
@@ -1934,7 +1973,8 @@ function RowCellEditor({ cell }) {
1934
1973
  pending,
1935
1974
  mode: "row",
1936
1975
  autoFocus,
1937
- label
1976
+ label,
1977
+ size: SIZES[size].control
1938
1978
  });
1939
1979
  return /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("div", {
1940
1980
  ref: containerRef,
@@ -2327,7 +2367,7 @@ function usePinnedRowOffsets(topCount, bottomCount) {
2327
2367
  * variables).
2328
2368
  */
2329
2369
  const TREE_INDENT_PX = 20;
2330
- const DEFAULT_ESTIMATED_ROW_HEIGHT = 44;
2370
+ const DEFAULT_ESTIMATED_ROW_HEIGHT = SIZES.sm.rowHeight;
2331
2371
  const DEFAULT_OVERSCAN = 8;
2332
2372
  /**
2333
2373
  * Whether any leaf definition declares a merge — the gate that keeps span-index reads (and the
@@ -2375,7 +2415,7 @@ function countDisplayRows(rows, withDetailPanels) {
2375
2415
  * Grouped cell: expander, the grouped value, and the group size.
2376
2416
  */
2377
2417
  function GroupCell({ cell }) {
2378
- const { labels, icons, expansion } = useDataTableContext();
2418
+ const { labels, icons, expansion, size } = useDataTableContext();
2379
2419
  const { row } = cell;
2380
2420
  const expandedGroup = row.getIsExpanded();
2381
2421
  const canExpandGroup = row.getCanExpand();
@@ -2386,13 +2426,13 @@ function GroupCell({ cell }) {
2386
2426
  "aria-expanded": expandedGroup,
2387
2427
  "aria-label": expandedGroup ? labels.collapseRow : labels.expandRow,
2388
2428
  "data-expanded": expandedGroup || void 0,
2389
- size: "xs",
2429
+ size: SIZES[size].control,
2390
2430
  variant: "subtle",
2391
2431
  onClick: (event) => {
2392
2432
  event.stopPropagation();
2393
2433
  expansion?.toggle(row.id, expandedGroup, canExpandGroup);
2394
2434
  },
2395
- children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.expandRow, { size: 12 })
2435
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.expandRow, { size: SIZES[size].glyph })
2396
2436
  }),
2397
2437
  (0, _tanstack_react_table.flexRender)(cell.column.columnDef.cell, cell.getContext()),
2398
2438
  /* @__PURE__ */ (0, react_jsx_runtime.jsxs)("span", {
@@ -2416,7 +2456,7 @@ function GroupCell({ cell }) {
2416
2456
  * `onRowClick` out.
2417
2457
  */
2418
2458
  function InstantCell({ cell, render }) {
2419
- const { labels, getStyles } = useDataTableContext();
2459
+ const { labels, getStyles, size } = useDataTableContext();
2420
2460
  const { table } = cell.getContext();
2421
2461
  const instant = table.options.meta?.ledger?.editing.instant;
2422
2462
  const rowId = cell.row.id;
@@ -2448,7 +2488,8 @@ function InstantCell({ cell, render }) {
2448
2488
  commit: (next) => instant.commit(rowId, columnId, next),
2449
2489
  pending,
2450
2490
  error,
2451
- label: labels.editColumn(columnHeaderText(cell.column))
2491
+ label: labels.editColumn(columnHeaderText(cell.column)),
2492
+ size: SIZES[size].control
2452
2493
  }),
2453
2494
  pending && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Loader, {
2454
2495
  "aria-label": labels.editPending,
@@ -3020,7 +3061,7 @@ function autosizeColumn(setColumnSizing, { columnId, minSize, maxSize, hasFilter
3020
3061
  */
3021
3062
  const FACETED_OPTIONS_CAP = 100;
3022
3063
  function FilterPopover({ column }) {
3023
- const { labels, icons, getStyles, filterMode } = useDataTableContext();
3064
+ const { labels, icons, getStyles, filterMode, size } = useDataTableContext();
3024
3065
  const filter = column.columnDef.meta?.filter;
3025
3066
  if (!filter || !column.getCanFilter()) return null;
3026
3067
  const active = column.getFilterValue() !== void 0;
@@ -3032,7 +3073,7 @@ function FilterPopover({ column }) {
3032
3073
  children: [/* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Popover.Target, { children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.ActionIcon, {
3033
3074
  "aria-label": name,
3034
3075
  "data-active": active || void 0,
3035
- size: "sm",
3076
+ size: SIZES[size].control,
3036
3077
  variant: active ? "light" : "subtle",
3037
3078
  onClick: (event) => event.stopPropagation(),
3038
3079
  children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.filterColumn, {})
@@ -3474,8 +3515,9 @@ function TableHeader({ table, columnWidths, columnSizing, columnWindow }) {
3474
3515
  });
3475
3516
  }
3476
3517
  function HeaderCell({ header, table, reorder, resize, columnWidths, columnSizing, colSpan, ariaColIndex }) {
3477
- const { getStyles, labels, icons } = useDataTableContext();
3518
+ const { getStyles, labels, icons, size } = useDataTableContext();
3478
3519
  const { column } = header;
3520
+ const { glyph } = SIZES[size];
3479
3521
  const { meta } = column.columnDef;
3480
3522
  const internal = isInternalColumn(column.id);
3481
3523
  const canSort = column.getCanSort();
@@ -3551,9 +3593,9 @@ function HeaderCell({ header, table, reorder, resize, columnWidths, columnSizing
3551
3593
  ...getStyles("sortIndicator"),
3552
3594
  "data-sorted": sorted || void 0,
3553
3595
  children: [
3554
- sorted === "asc" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.sortAsc, { size: 14 }),
3555
- sorted === "desc" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.sortDesc, { size: 14 }),
3556
- sorted === false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.sortable, { size: 14 }),
3596
+ sorted === "asc" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.sortAsc, { size: glyph }),
3597
+ sorted === "desc" && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.sortDesc, { size: glyph }),
3598
+ sorted === false && /* @__PURE__ */ (0, react_jsx_runtime.jsx)(icons.sortable, { size: glyph }),
3557
3599
  sorted !== false && sortCount > 1 && sortIndex >= 0 && /* @__PURE__ */ (0, react_jsx_runtime.jsx)("sup", { children: sortIndex + 1 })
3558
3600
  ]
3559
3601
  })]
@@ -3706,7 +3748,7 @@ function minWidthPx(tableMinWidth, viewport) {
3706
3748
  if (!tableElement) return Number.parseFloat(tableMinWidth) || 0;
3707
3749
  return Number.parseFloat(getComputedStyle(tableElement).minWidth) || 0;
3708
3750
  }
3709
- function useColumnWidths(table, columns, viewport, tableMinWidth) {
3751
+ function useColumnWidths(table, columns, viewport, tableMinWidth, injectedWidth) {
3710
3752
  const [availableWidth, setAvailableWidth] = (0, react.useState)(0);
3711
3753
  const measure = (0, react.useCallback)(() => {
3712
3754
  if (!viewport) return;
@@ -3725,6 +3767,12 @@ function useColumnWidths(table, columns, viewport, tableMinWidth) {
3725
3767
  const resolved = (0, react.useMemo)(() => {
3726
3768
  return resolveColumnWidths(columns.map((column) => {
3727
3769
  const raw = rawColumnSizing(column.columnDef);
3770
+ if (isInternalColumn(column.id)) return {
3771
+ id: column.id,
3772
+ size: raw?.size ?? injectedWidth,
3773
+ minSize: raw?.minSize ?? injectedWidth,
3774
+ maxSize: raw?.maxSize ?? injectedWidth
3775
+ };
3728
3776
  return {
3729
3777
  id: column.id,
3730
3778
  size: raw ? raw.size ?? defaultColumn?.size : column.columnDef.size,
@@ -3736,7 +3784,8 @@ function useColumnWidths(table, columns, viewport, tableMinWidth) {
3736
3784
  columns,
3737
3785
  columnSizing,
3738
3786
  availableWidth,
3739
- defaultColumn
3787
+ defaultColumn,
3788
+ injectedWidth
3740
3789
  ]);
3741
3790
  const signature = JSON.stringify([resolved.total, Object.entries(resolved.byId)]);
3742
3791
  return (0, react.useMemo)(() => resolved, [signature]);
@@ -6411,8 +6460,7 @@ const defaultProps = {
6411
6460
  withColumnBorders: false,
6412
6461
  withRowBorders: true,
6413
6462
  withBottomBorder: false,
6414
- verticalSpacing: "xs",
6415
- horizontalSpacing: "xs",
6463
+ size: "sm",
6416
6464
  tabularNums: false,
6417
6465
  virtualizedRows: false,
6418
6466
  virtualizedColumns: false,
@@ -6426,12 +6474,13 @@ const defaultProps = {
6426
6474
  function leafCol(column) {
6427
6475
  return /* @__PURE__ */ (0, react_jsx_runtime.jsx)("col", { style: { width: `var(${columnWidthVar(column.id)})` } }, column.id);
6428
6476
  }
6429
- const varsResolver = (0, _mantine_core.createVarsResolver)((theme, { stripedColor, highlightOnHoverColor, borderColor, radius }) => {
6477
+ const varsResolver = (0, _mantine_core.createVarsResolver)((theme, { stripedColor, highlightOnHoverColor, borderColor, radius, size }) => {
6430
6478
  return { root: {
6431
6479
  "--ledger-striped-color": stripedColor ? (0, _mantine_core.getThemeColor)(stripedColor, theme) : void 0,
6432
6480
  "--ledger-hover-color": highlightOnHoverColor ? (0, _mantine_core.getThemeColor)(highlightOnHoverColor, theme) : void 0,
6433
6481
  "--ledger-border-color": borderColor ? (0, _mantine_core.getThemeColor)(borderColor, theme) : void 0,
6434
- "--ledger-radius": radius === void 0 ? void 0 : (0, _mantine_core.getRadius)(radius)
6482
+ "--ledger-radius": radius === void 0 ? void 0 : (0, _mantine_core.getRadius)(radius),
6483
+ "--ledger-font-size": (0, _mantine_core.getFontSize)(size)
6435
6484
  } };
6436
6485
  });
6437
6486
  const OPTION_KEY_SET = /* @__PURE__ */ new Set([
@@ -6552,7 +6601,7 @@ function DataTableFromOptions({ props }) {
6552
6601
  });
6553
6602
  }
6554
6603
  function DataTableCore({ presentation, stylesProps, table }) {
6555
- const { striped, stripedColor: _stripedColor, highlightOnHover, highlightOnHoverColor: _highlightOnHoverColor, withTableBorder, withColumnBorders, withRowBorders, withBottomBorder, borderColor: _borderColor, radius: _radius, verticalSpacing, horizontalSpacing, tabularNums, tableMinWidth, virtualizedRows, virtualizedColumns, onEndReached, endReachedOffset, loadingMore, loadMoreError, loading, emptyState, error, onRetry, withColumnHeaders, withPaginationBar, pageSizeOptions, onRowClick, onRowActivate, onRowDoubleClick, onRowContextMenu, rowProps, headerRowProps, footerRowProps, viewportProps, labels: labelsProp, icons: iconsProp, handleRef, ref: rootRef, classNames, styles, unstyled, vars, className, style, attributes, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...others } = presentation;
6604
+ const { striped, stripedColor: _stripedColor, highlightOnHover, highlightOnHoverColor: _highlightOnHoverColor, withTableBorder, withColumnBorders, withRowBorders, withBottomBorder, borderColor: _borderColor, radius: _radius, size: sizeProp, verticalSpacing, horizontalSpacing, tabularNums, tableMinWidth, virtualizedRows, virtualizedColumns, onEndReached, endReachedOffset, loadingMore, loadMoreError, loading, emptyState, error, onRetry, withColumnHeaders, withPaginationBar, pageSizeOptions, onRowClick, onRowActivate, onRowDoubleClick, onRowContextMenu, rowProps, headerRowProps, footerRowProps, viewportProps, labels: labelsProp, icons: iconsProp, handleRef, ref: rootRef, classNames, styles, unstyled, vars, className, style, attributes, "aria-label": ariaLabel, "aria-labelledby": ariaLabelledBy, "aria-describedby": ariaDescribedBy, ...others } = presentation;
6556
6605
  const getStyles = (0, _mantine_core.useStyles)({
6557
6606
  name: "DataTable",
6558
6607
  classes,
@@ -6605,9 +6654,11 @@ function DataTableCore({ presentation, stylesProps, table }) {
6605
6654
  const displayOrderSignature = JSON.stringify(displayColumns.map((column) => column.id));
6606
6655
  const ledgerColumns = table.options.meta?.ledger?.columns;
6607
6656
  const visibleLeafColumns = (0, react.useMemo)(() => displayColumns, [displayOrderSignature, ledgerColumns]);
6608
- const columnWidths = useColumnWidths(table, visibleLeafColumns, viewport, tableMinWidth);
6657
+ const size = sizeProp ?? "sm";
6658
+ const scale = SIZES[size];
6659
+ const columnWidths = useColumnWidths(table, visibleLeafColumns, viewport, tableMinWidth, scale.injectedWidth);
6609
6660
  const virtualization = virtualizedRows ? {
6610
- estimateHeight: typeof virtualizedRows === "object" && virtualizedRows.estimateHeight !== void 0 ? virtualizedRows.estimateHeight : 44,
6661
+ estimateHeight: typeof virtualizedRows === "object" && virtualizedRows.estimateHeight !== void 0 ? virtualizedRows.estimateHeight : scale.rowHeight,
6611
6662
  overscan: typeof virtualizedRows === "object" && virtualizedRows.overscan !== void 0 ? virtualizedRows.overscan : 8
6612
6663
  } : null;
6613
6664
  const virtualEnabled = virtualization !== null;
@@ -7037,11 +7088,11 @@ function DataTableCore({ presentation, stylesProps, table }) {
7037
7088
  ]);
7038
7089
  const stripedMode = striped === true ? "odd" : striped || void 0;
7039
7090
  const sharedTableProps = {
7040
- horizontalSpacing,
7091
+ horizontalSpacing: horizontalSpacing ?? scale.horizontalSpacing,
7041
7092
  layout: "fixed",
7042
7093
  role: "presentation",
7043
7094
  tabularNums,
7044
- verticalSpacing
7095
+ verticalSpacing: verticalSpacing ?? scale.verticalSpacing
7045
7096
  };
7046
7097
  const tableStyleProps = () => getStyles("table", { style: {
7047
7098
  width: columnWidths.total > 0 ? columnWidths.total : void 0,
@@ -7077,6 +7128,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
7077
7128
  getStyles: stylesRevision,
7078
7129
  labels,
7079
7130
  icons,
7131
+ size,
7080
7132
  filterMode,
7081
7133
  virtualizedRows: virtualEnabled,
7082
7134
  withColumnHeaders: columnHeadersVisible,
@@ -7100,6 +7152,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
7100
7152
  stylesRevision,
7101
7153
  labels,
7102
7154
  icons,
7155
+ size,
7103
7156
  filterMode,
7104
7157
  virtualEnabled,
7105
7158
  columnHeadersVisible,
@@ -7123,6 +7176,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
7123
7176
  "data-loading": loading || void 0,
7124
7177
  "data-scrolled-end": scrollEdges.end || void 0,
7125
7178
  "data-scrolled-start": scrollEdges.start || void 0,
7179
+ "data-size": size,
7126
7180
  "data-striped": stripedMode,
7127
7181
  "data-virtualized-columns": columnWindow !== null || void 0,
7128
7182
  "data-virtualized-rows": virtualEnabled || void 0,
@@ -7287,14 +7341,15 @@ DataTable.SelectionBar = DataTableSelectionBar;
7287
7341
  * The shipped editor renderers — conveniences, never the mechanism. Each is an ordinary
7288
7342
  * renderer over the public editing contexts (docs/editing.md#editors), which is the proof the
7289
7343
  * contexts suffice: anything these do, an application's own renderer can do the same way.
7290
- * All are default-variant Mantine inputs — the border marks the cell as an open editor.
7344
+ * All are default-variant Mantine inputs at the context's `size` — the border marks the cell as an
7345
+ * open editor, and the size keeps it inside the row.
7291
7346
  */
7292
- const renderTextEditor = ({ value, setValue, error, pending, autoFocus, label }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.TextInput, {
7347
+ const renderTextEditor = ({ value, setValue, error, pending, autoFocus, label, size }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.TextInput, {
7293
7348
  "aria-label": label,
7294
7349
  autoFocus,
7295
7350
  disabled: pending,
7296
7351
  error,
7297
- size: "xs",
7352
+ size,
7298
7353
  value: value === null || value === void 0 ? "" : String(value),
7299
7354
  onChange: (event) => setValue(event.currentTarget.value)
7300
7355
  });
@@ -7304,13 +7359,13 @@ const renderTextEditor = ({ value, setValue, error, pending, autoFocus, label })
7304
7359
  function textEditor() {
7305
7360
  return renderTextEditor;
7306
7361
  }
7307
- const renderNumberEditor = ({ value, setValue, error, pending, autoFocus, label }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.NumberInput, {
7362
+ const renderNumberEditor = ({ value, setValue, error, pending, autoFocus, label, size }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.NumberInput, {
7308
7363
  hideControls: true,
7309
7364
  "aria-label": label,
7310
7365
  autoFocus,
7311
7366
  disabled: pending,
7312
7367
  error,
7313
- size: "xs",
7368
+ size,
7314
7369
  value: typeof value === "number" || typeof value === "string" ? value : "",
7315
7370
  onChange: (next) => setValue(next === "" ? null : next)
7316
7371
  });
@@ -7326,7 +7381,7 @@ function numberEditor() {
7326
7381
  * draft-bound field among the row's others, and the row's own commit decides.
7327
7382
  */
7328
7383
  function selectEditor(options) {
7329
- return ({ value, setValue, commit, error, pending, mode, autoFocus, label }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Select, {
7384
+ return ({ value, setValue, commit, error, pending, mode, autoFocus, label, size }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Select, {
7330
7385
  "aria-label": label,
7331
7386
  autoFocus,
7332
7387
  comboboxProps: { withinPortal: true },
@@ -7334,7 +7389,7 @@ function selectEditor(options) {
7334
7389
  defaultDropdownOpened: mode === "cell",
7335
7390
  disabled: pending,
7336
7391
  error,
7337
- size: "xs",
7392
+ size,
7338
7393
  value: value === null || value === void 0 ? null : String(value),
7339
7394
  onChange: (next) => {
7340
7395
  setValue(next);
@@ -7342,12 +7397,12 @@ function selectEditor(options) {
7342
7397
  }
7343
7398
  });
7344
7399
  }
7345
- const renderCheckboxEditor = ({ value, commit, pending, error, label }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Checkbox, {
7400
+ const renderCheckboxEditor = ({ value, commit, pending, error, label, size }) => /* @__PURE__ */ (0, react_jsx_runtime.jsx)(_mantine_core.Checkbox, {
7346
7401
  "aria-label": label,
7347
7402
  checked: Boolean(value),
7348
7403
  disabled: pending,
7349
7404
  error: Boolean(error),
7350
- size: "xs",
7405
+ size,
7351
7406
  onChange: (event) => void commit(event.currentTarget.checked)
7352
7407
  });
7353
7408
  /**