@coldsmirk/ledger-mantine 0.8.0 → 0.9.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.d.cts CHANGED
@@ -881,7 +881,7 @@ declare module "@tanstack/react-table" {
881
881
  /**
882
882
  * DOM props for this column's footer cell — static, or per footer.
883
883
  */
884
- footerCellProps?: DataTableElementProps<Omit<TableThProps, "ref">, Header<TData, TValue>>;
884
+ footerCellProps?: DataTableElementProps<Omit<TableTdProps, "ref">, Header<TData, TValue>>;
885
885
  /**
886
886
  * `toCsv` column control: `false` excludes the column; an object overrides the exported
887
887
  * header text or derives the exported value.
@@ -1009,9 +1009,10 @@ interface DataTableBaseProps<TData extends RowData$1> extends BoxProps, StylesAp
1009
1009
  withColumnBorders?: boolean;
1010
1010
  withRowBorders?: boolean;
1011
1011
  /**
1012
- * The closing line under the last row — and under a footer — for a table that stands alone
1013
- * without a frame. Mantine's `Table` leaves the last row open, so this is off by default; the
1014
- * `withTableBorder` frame closes the table itself and ignores it (docs/styling.md#borders).
1012
+ * The closing line on the body's bottom edge — and under a footer — for a table that stands
1013
+ * alone without a frame. Mantine's `Table` leaves a last row on that edge open, so this is off
1014
+ * by default; the `withTableBorder` frame closes the table itself and ignores it
1015
+ * (docs/styling.md#borders).
1015
1016
  */
1016
1017
  withBottomBorder?: boolean;
1017
1018
  borderColor?: MantineColor;
package/dist/index.d.ts CHANGED
@@ -881,7 +881,7 @@ declare module "@tanstack/react-table" {
881
881
  /**
882
882
  * DOM props for this column's footer cell — static, or per footer.
883
883
  */
884
- footerCellProps?: DataTableElementProps<Omit<TableThProps, "ref">, Header<TData, TValue>>;
884
+ footerCellProps?: DataTableElementProps<Omit<TableTdProps, "ref">, Header<TData, TValue>>;
885
885
  /**
886
886
  * `toCsv` column control: `false` excludes the column; an object overrides the exported
887
887
  * header text or derives the exported value.
@@ -1009,9 +1009,10 @@ interface DataTableBaseProps<TData extends RowData$1> extends BoxProps, StylesAp
1009
1009
  withColumnBorders?: boolean;
1010
1010
  withRowBorders?: boolean;
1011
1011
  /**
1012
- * The closing line under the last row — and under a footer — for a table that stands alone
1013
- * without a frame. Mantine's `Table` leaves the last row open, so this is off by default; the
1014
- * `withTableBorder` frame closes the table itself and ignores it (docs/styling.md#borders).
1012
+ * The closing line on the body's bottom edge — and under a footer — for a table that stands
1013
+ * alone without a frame. Mantine's `Table` leaves a last row on that edge open, so this is off
1014
+ * by default; the `withTableBorder` frame closes the table itself and ignores it
1015
+ * (docs/styling.md#borders).
1015
1016
  */
1016
1017
  withBottomBorder?: boolean;
1017
1018
  borderColor?: MantineColor;
package/dist/index.js CHANGED
@@ -9,7 +9,7 @@ import { AutoScroller, Cursor, PointerActivationConstraints, PreventSelection }
9
9
  import { memo, startTransition, useCallback, useEffect, useId, useImperativeHandle, useInsertionEffect, useLayoutEffect, useMemo, useReducer, useRef, useState } from "react";
10
10
  import { useDebouncedCallback, useUncontrolled } from "@mantine/hooks";
11
11
  import { aggregationFn_count, aggregationFn_extent, aggregationFn_first, aggregationFn_last, aggregationFn_max, aggregationFn_mean, aggregationFn_median, aggregationFn_min, aggregationFn_sum, aggregationFn_unique, aggregationFn_uniqueCount, cellSpanningFeature, columnFacetingFeature, columnFilteringFeature, columnGroupingFeature, columnOrderingFeature, columnPinningFeature, columnSizingFeature, columnVisibilityFeature, createColumnHelper as createColumnHelper$1, createExpandedRowModel, createFacetedMinMaxValues, createFacetedRowModel, createFacetedUniqueValues, createFilteredRowModel, createGroupedRowModel, createPaginatedRowModel, createSortedRowModel, filterFn_arrHas, filterFn_arrIncludes, filterFn_arrIncludesAll, filterFn_arrIncludesSome, filterFn_between, filterFn_betweenInclusive, filterFn_empty, filterFn_endsWith, filterFn_equals, filterFn_equalsString, filterFn_equalsStringSensitive, filterFn_greaterThan, filterFn_greaterThanOrEqualTo, filterFn_inDateRange, filterFn_inNumberRange, filterFn_includesString, filterFn_includesStringSensitive, filterFn_lessThan, filterFn_lessThanOrEqualTo, filterFn_notEmpty, filterFn_startsWith, filterFn_weakEquals, flexRender, flexRender as flexRender$1, functionalUpdate, globalFilteringFeature, rowAggregationFeature, rowExpandingFeature, rowPaginationFeature, rowPinningFeature, rowSelectionFeature, rowSortingFeature, sortFn_alphanumeric, sortFn_alphanumericCaseSensitive, sortFn_basic, sortFn_datetime, sortFn_text, sortFn_textCaseSensitive, tableFeatures, useTable } from "@tanstack/react-table";
12
- import { useVirtualizer } from "@tanstack/react-virtual";
12
+ import { measureElement, useVirtualizer } from "@tanstack/react-virtual";
13
13
  import { DatePicker } from "@mantine/dates";
14
14
  //#region src/context.ts
15
15
  /**
@@ -597,6 +597,7 @@ function RowDragCell({ row, table }) {
597
597
  "aria-pressed": lifted || void 0,
598
598
  color: "gray",
599
599
  size: SIZES[size].control,
600
+ style: { cursor: orderable ? "grab" : "default" },
600
601
  variant: "subtle",
601
602
  onBlur: () => {
602
603
  if (lifted) rowReorderKeyboard?.cancel();
@@ -1356,6 +1357,7 @@ function ColumnsPanelItem({ column, table, labels, icons, index, zone, orderable
1356
1357
  className: "ledger-columns-panel-handle",
1357
1358
  color: "gray",
1358
1359
  size: "sm",
1360
+ style: { cursor: isDragging ? "grabbing" : "grab" },
1359
1361
  variant: "subtle",
1360
1362
  children: /* @__PURE__ */ jsx(icons.reorderColumn, {})
1361
1363
  })
@@ -1675,7 +1677,8 @@ function PaginationBarCore({ table, labels, pageSizeOptions, size, className, st
1675
1677
  children: labels.paginationSummary(from, to, total)
1676
1678
  }), /* @__PURE__ */ jsxs(Group, {
1677
1679
  gap: "md",
1678
- wrap: "nowrap",
1680
+ justify: "flex-end",
1681
+ wrap: "wrap",
1679
1682
  children: [/* @__PURE__ */ jsxs(Group, {
1680
1683
  gap: "xs",
1681
1684
  wrap: "nowrap",
@@ -1683,6 +1686,7 @@ function PaginationBarCore({ table, labels, pageSizeOptions, size, className, st
1683
1686
  c: "var(--ledger-color-dimmed)",
1684
1687
  id: pageSizeLabelId,
1685
1688
  size,
1689
+ style: { whiteSpace: "nowrap" },
1686
1690
  children: labels.rowsPerPage
1687
1691
  }, "label"), /* @__PURE__ */ jsx(Select, {
1688
1692
  allowDeselect: false,
@@ -1861,7 +1865,7 @@ function cellValue(cell) {
1861
1865
  */
1862
1866
  function canEditWith(row, edit, gate) {
1863
1867
  if (!gate.enableEditing || !gate.hasCommitHandler) return false;
1864
- if (!edit) return false;
1868
+ if (!edit || row.getIsGrouped()) return false;
1865
1869
  return !(typeof edit === "object" && edit.enabled && !edit.enabled(row));
1866
1870
  }
1867
1871
  /**
@@ -2428,6 +2432,15 @@ const TREE_INDENT_PX = 20;
2428
2432
  const DEFAULT_ESTIMATED_ROW_HEIGHT = SIZES.sm.rowHeight;
2429
2433
  const DEFAULT_OVERSCAN = 8;
2430
2434
  /**
2435
+ * A row's height as layout has it, fractions included. TanStack Virtual rounds every measurement
2436
+ * to the pixel, and a row is seldom a whole number of pixels tall (Mantine's line height is 1.55):
2437
+ * each measured row then counted up to half a pixel wrong, the virtualizer's idea of where a row
2438
+ * starts drifted from the DOM by that much per row, and `scrollToRow` landed its row a few pixels
2439
+ * under the header. The resize entry's border box is exact. Without an entry (a row mounting) the
2440
+ * default answers from its cache or the element, and the entry that follows corrects it.
2441
+ */
2442
+ const measureRow = (element, entry, instance) => entry?.borderBoxSize[0]?.blockSize ?? measureElement(element, entry, instance);
2443
+ /**
2431
2444
  * Whether any leaf definition declares a merge — the gate that keeps span-index reads (and the
2432
2445
  * per-row span signature) entirely out of tables that never span.
2433
2446
  */
@@ -2569,9 +2582,10 @@ function DataCell({ cell, editing, rowEditing, isFirstDataCell, depth, rowSpan,
2569
2582
  const editMode = ledger?.editing.mode ?? "cell";
2570
2583
  const { meta } = column.columnDef;
2571
2584
  const grouped = cell.getIsGrouped();
2572
- const aggregated = cell.getIsAggregated() && row.getIsGrouped();
2573
- const placeholder = cell.getIsPlaceholder();
2574
- const gateOpen = !grouped && !aggregated && !placeholder && canEditCell(cell, row);
2585
+ const groupRow = row.getIsGrouped();
2586
+ const aggregated = cell.getIsAggregated() && groupRow;
2587
+ const empty = cell.getIsPlaceholder() || groupRow && !grouped && !aggregated && !isInternalColumn(column.id);
2588
+ const gateOpen = !empty && canEditCell(cell, row);
2575
2589
  const editable = !editing && gateOpen;
2576
2590
  const cellEditorActive = editing && gateOpen;
2577
2591
  const rowEditorActive = rowEditing && gateOpen;
@@ -2579,8 +2593,8 @@ function DataCell({ cell, editing, rowEditing, isFirstDataCell, depth, rowSpan,
2579
2593
  const instantEdit = normalizedEdit?.kind === "instant" ? normalizedEdit : null;
2580
2594
  let content;
2581
2595
  if (grouped) content = /* @__PURE__ */ jsx(GroupCell, { cell });
2582
- else if (aggregated) content = flexRender$1(column.columnDef.aggregatedCell ?? column.columnDef.cell, cell.getContext());
2583
- else if (placeholder) content = null;
2596
+ else if (aggregated) content = flexRender$1(column.columnDef.aggregatedCell, cell.getContext());
2597
+ else if (empty) content = null;
2584
2598
  else if (cellEditorActive) content = /* @__PURE__ */ jsx(CellEditor, { cell });
2585
2599
  else if (rowEditorActive) content = /* @__PURE__ */ jsx(RowCellEditor, { cell });
2586
2600
  else if (editable && instantEdit && editMode === "cell") content = /* @__PURE__ */ jsx(InstantCell, {
@@ -2722,6 +2736,7 @@ function DetailRow({ row, renderDetailPanel, colSpan, dragging, dropSide, last,
2722
2736
  role: "row",
2723
2737
  ...getStyles("row", { style: pinnedStyle }),
2724
2738
  children: /* @__PURE__ */ jsx(Table.Td, {
2739
+ "data-leading": true,
2725
2740
  colSpan,
2726
2741
  role: "cell",
2727
2742
  ...getStyles("detailPanel"),
@@ -2737,10 +2752,12 @@ function SkeletonRows({ rowCount, columnCount, ariaRowIndexStart }) {
2737
2752
  role: "row",
2738
2753
  ...getStyles("row"),
2739
2754
  children: Array.from({ length: columnCount }, (_, columnIndex) => /* @__PURE__ */ jsx(Table.Td, {
2755
+ "data-leading": columnIndex === 0 || void 0,
2740
2756
  role: "cell",
2741
2757
  ...getStyles("cell"),
2742
2758
  children: /* @__PURE__ */ jsx(Skeleton, {
2743
2759
  height: 10,
2760
+ my: "calc((1lh - 10px) / 2)",
2744
2761
  radius: "sm"
2745
2762
  })
2746
2763
  }, columnIndex))
@@ -2753,6 +2770,7 @@ function LoaderRow({ colSpan, ariaRowIndex }) {
2753
2770
  role: "row",
2754
2771
  ...getStyles("loaderRow"),
2755
2772
  children: /* @__PURE__ */ jsx(Table.Td, {
2773
+ "data-leading": true,
2756
2774
  colSpan,
2757
2775
  role: "cell",
2758
2776
  children: /* @__PURE__ */ jsxs("div", {
@@ -2773,6 +2791,7 @@ function LoadMoreErrorRow({ colSpan, message, ariaRowIndex, onRetry }) {
2773
2791
  role: "row",
2774
2792
  ...getStyles("loaderRow"),
2775
2793
  children: /* @__PURE__ */ jsx(Table.Td, {
2794
+ "data-leading": true,
2776
2795
  colSpan,
2777
2796
  role: "cell",
2778
2797
  children: /* @__PURE__ */ jsxs("div", {
@@ -2826,6 +2845,7 @@ function TableBody({ table, virtualization, columnWindow, viewportRef, loading,
2826
2845
  estimateSize,
2827
2846
  getItemKey,
2828
2847
  getScrollElement: () => viewportRef.current,
2848
+ measureElement: measureRow,
2829
2849
  overscan: virtualization?.overscan ?? DEFAULT_OVERSCAN,
2830
2850
  useFlushSync: false
2831
2851
  });
@@ -3013,7 +3033,7 @@ function tableHasFooter(table) {
3013
3033
  }
3014
3034
  function TableFooter({ table, ariaRowIndexStart, columnWindow }) {
3015
3035
  const { getStyles, footerRowProps } = useDataTableContext();
3016
- const renderCell = (footer, colSpan, ariaColIndex) => /* @__PURE__ */ jsx(Table.Th, {
3036
+ const renderCell = (footer, colSpan, ariaColIndex) => /* @__PURE__ */ jsx(Table.Td, {
3017
3037
  ...mergeElementProps(resolveElementProps(footer.column.columnDef.meta?.footerCellProps, footer), {
3018
3038
  "aria-colindex": ariaColIndex,
3019
3039
  colSpan: colSpan ?? footer.colSpan,
@@ -3034,7 +3054,7 @@ function TableFooter({ table, ariaRowIndexStart, columnWindow }) {
3034
3054
  role: "row",
3035
3055
  ...getStyles("footerRow")
3036
3056
  }),
3037
- children: columnWindow === null ? footerGroup.headers.map((footer) => renderCell(footer, void 0, void 0)) : windowHeaderCells(footerGroup.headers, columnWindow).map((cell) => cell.kind === "spacer" ? /* @__PURE__ */ jsx("th", {
3057
+ children: columnWindow === null ? footerGroup.headers.map((footer) => renderCell(footer, void 0, void 0)) : windowHeaderCells(footerGroup.headers, columnWindow).map((cell) => cell.kind === "spacer" ? /* @__PURE__ */ jsx("td", {
3038
3058
  "aria-hidden": true,
3039
3059
  "data-ledger-spacer": true
3040
3060
  }, `ledger:spacer-${cell.edge}`) : renderCell(cell.header, cell.colSpan, cell.ariaColIndex))
@@ -3053,9 +3073,12 @@ function TableFooter({ table, ariaRowIndexStart, columnWindow }) {
3053
3073
  * The column, its constraints and whether it carries a filter all arrive from the render that put
3054
3074
  * the handle on screen, for the reason `use-column-resize.ts` gives.
3055
3075
  *
3056
- * Measurement forces `white-space: nowrap` on every cell first and reads afterwards, so the
3057
- * whole pass costs one reflow. Truncating cells clip their own overflow (the td never grows),
3058
- * so the content width is read from the `[data-truncate]` span instead of the cell box.
3076
+ * A content cell is measured out of the table's layout: for the pass it is a block as wide as its
3077
+ * content (`display: block; width: max-content`, no wrapping), so its width is the content's, in
3078
+ * whichever direction that lies. Read in place, a cell is never narrower than its column — a fixed
3079
+ * table lays every cell at the column's width, and a truncating span clips at it — so a fit could
3080
+ * only ever widen a column. Every cell is switched first and read afterwards, so the whole pass
3081
+ * costs one reflow, and each gets its own inline styles back before anything paints.
3059
3082
  */
3060
3083
  /**
3061
3084
  * Breathing room over the tightest fit — content flush against the column edge reads clipped.
@@ -3076,10 +3099,6 @@ function horizontalPadding(element) {
3076
3099
  const style = getComputedStyle(element);
3077
3100
  return asPx(style.paddingInlineStart) + asPx(style.paddingInlineEnd);
3078
3101
  }
3079
- function bodyCellWidth(cell) {
3080
- const truncated = cell.querySelector(":scope [data-truncate]");
3081
- return truncated ? truncated.scrollWidth + horizontalPadding(cell) : cell.scrollWidth;
3082
- }
3083
3102
  function headerCellWidth(th, hasFilter) {
3084
3103
  const labelText = th.querySelector(":scope .ledger-header-label [data-truncate]");
3085
3104
  if (!labelText) return th.scrollWidth;
@@ -3090,16 +3109,29 @@ function headerCellWidth(th, hasFilter) {
3090
3109
  function autosizeColumn(setColumnSizing, { columnId, minSize, maxSize, hasFilter }, main) {
3091
3110
  const selector = `[data-ledger-column-id="${CSS.escape(columnId)}"]`;
3092
3111
  const headerCell = main.querySelector(`:scope .ledger-header ${selector}`);
3093
- const bodyCells = [...main.querySelectorAll(`:scope .ledger-tbody ${selector}`)];
3094
- const footerCells = [...main.querySelectorAll(`:scope .ledger-footer ${selector}`)].filter((cell) => cell.colSpan <= 1);
3095
- const contentCells = [...bodyCells, ...footerCells];
3112
+ const contentCells = [...main.querySelectorAll(`:scope :is(.ledger-tbody, .ledger-footer) ${selector}`)].filter((cell) => cell.colSpan <= 1);
3096
3113
  const cells = headerCell ? [headerCell, ...contentCells] : contentCells;
3097
3114
  if (cells.length === 0) return;
3098
- const previousWhitespace = cells.map((cell) => cell.style.whiteSpace);
3115
+ const previous = cells.map((cell) => {
3116
+ return {
3117
+ display: cell.style.display,
3118
+ whiteSpace: cell.style.whiteSpace,
3119
+ width: cell.style.width
3120
+ };
3121
+ });
3099
3122
  for (const cell of cells) cell.style.whiteSpace = "nowrap";
3123
+ for (const cell of contentCells) {
3124
+ cell.style.display = "block";
3125
+ cell.style.width = "max-content";
3126
+ }
3100
3127
  let content = headerCell ? headerCellWidth(headerCell, hasFilter) : 0;
3101
- for (const cell of contentCells) content = Math.max(content, bodyCellWidth(cell));
3102
- for (const [index, cell] of cells.entries()) cell.style.whiteSpace = previousWhitespace[index] ?? "";
3128
+ for (const cell of contentCells) content = Math.max(content, cell.scrollWidth);
3129
+ for (const [index, cell] of cells.entries()) {
3130
+ const styles = previous[index];
3131
+ cell.style.display = styles?.display ?? "";
3132
+ cell.style.whiteSpace = styles?.whiteSpace ?? "";
3133
+ cell.style.width = styles?.width ?? "";
3134
+ }
3103
3135
  const next = Math.min(Math.max(Math.round(content + AUTOSIZE_SLACK_PX), minSize), maxSize);
3104
3136
  setColumnSizing((previous) => previous[columnId] === next ? previous : {
3105
3137
  ...previous,
@@ -3299,6 +3331,7 @@ function RangeFilter({ column, name }) {
3299
3331
  wrap: "nowrap",
3300
3332
  children: [
3301
3333
  /* @__PURE__ */ jsx(NumberInput, {
3334
+ hideControls: true,
3302
3335
  "aria-label": labels.filterRangeMin,
3303
3336
  flex: 1,
3304
3337
  placeholder: facetMin === void 0 ? labels.filterRangeMin : String(facetMin),
@@ -3306,6 +3339,7 @@ function RangeFilter({ column, name }) {
3306
3339
  onChange: setBound(0)
3307
3340
  }),
3308
3341
  /* @__PURE__ */ jsx(NumberInput, {
3342
+ hideControls: true,
3309
3343
  "aria-label": labels.filterRangeMax,
3310
3344
  flex: 1,
3311
3345
  placeholder: facetMax === void 0 ? labels.filterRangeMax : String(facetMax),
@@ -3661,7 +3695,11 @@ function HeaderCell({ header, table, reorder, resize, columnWidths, columnSizing
3661
3695
  ...getStyles("headerCell", { style: pinnedCellStyle(column) }),
3662
3696
  ...reorder.getHeaderProps(column.id)
3663
3697
  }),
3664
- children: header.isPlaceholder ? null : internal ? label : /* @__PURE__ */ jsxs(Fragment, { children: [
3698
+ children: header.isPlaceholder ? null : internal ? /* @__PURE__ */ jsx("div", {
3699
+ ...getStyles("headerLabel"),
3700
+ "data-align": "center",
3701
+ children: label
3702
+ }) : /* @__PURE__ */ jsxs(Fragment, { children: [
3665
3703
  canSort ? /* @__PURE__ */ jsxs("button", {
3666
3704
  type: "button",
3667
3705
  onClick: handleSortClick,
@@ -6490,31 +6528,36 @@ function useStylesRevision(getStyles, selectors) {
6490
6528
  return revision;
6491
6529
  }
6492
6530
  //#endregion
6493
- //#region src/use-viewport-overflow.ts
6531
+ //#region src/use-viewport-fit.ts
6532
+ const UNMEASURED = {
6533
+ overflowing: false,
6534
+ underfilled: false
6535
+ };
6494
6536
  /**
6495
- * Whether the body viewport scrolls on either axis. A scroll container has to be reachable by
6496
- * keyboard to be scrolled by it (WCAG 2.1.1), while a focus stop over content that fits is a
6497
- * Tab press spent on nothing — so the viewport's focus stop follows this.
6498
- *
6499
- * Measured whenever the viewport or its content resizes: rows arriving, columns widening, or
6500
- * the host resizing the table each change the answer without a scroll event. A 1px tolerance
6501
- * absorbs fractional layout rounding, which would otherwise flicker the stop on and off.
6537
+ * Layout sizes only, never rects: a transform (a modal scaling in) would shrink a rect but not
6538
+ * the viewport's client box, and nothing re-measures when the transform ends. A 1px tolerance
6539
+ * absorbs fractional layout rounding, which would otherwise flicker either answer.
6502
6540
  */
6503
- function useViewportOverflow(viewport) {
6504
- const [overflowing, setOverflowing] = useState(false);
6541
+ function useViewportFit(viewport) {
6542
+ const [fit, setFit] = useState(UNMEASURED);
6505
6543
  useLayoutEffect(() => {
6506
6544
  if (!viewport) return;
6545
+ const content = viewport.firstElementChild;
6507
6546
  const measure = () => {
6508
- const next = viewport.scrollHeight - viewport.clientHeight > 1 || viewport.scrollWidth - viewport.clientWidth > 1;
6509
- setOverflowing(next);
6547
+ const overflowing = viewport.scrollHeight - viewport.clientHeight > 1 || viewport.scrollWidth - viewport.clientWidth > 1;
6548
+ const underfilled = content instanceof HTMLElement && viewport.clientHeight - content.offsetHeight >= 1;
6549
+ setFit((previous) => previous.overflowing === overflowing && previous.underfilled === underfilled ? previous : {
6550
+ overflowing,
6551
+ underfilled
6552
+ });
6510
6553
  };
6511
6554
  measure();
6512
6555
  const observer = new ResizeObserver(measure);
6513
6556
  observer.observe(viewport);
6514
- if (viewport.firstElementChild) observer.observe(viewport.firstElementChild);
6557
+ if (content) observer.observe(content);
6515
6558
  return () => observer.disconnect();
6516
6559
  }, [viewport]);
6517
- return overflowing;
6560
+ return fit;
6518
6561
  }
6519
6562
  //#endregion
6520
6563
  //#region src/data-table.tsx
@@ -6766,7 +6809,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
6766
6809
  viewportRef.current = element;
6767
6810
  setViewport(element);
6768
6811
  }, []);
6769
- const viewportOverflows = useViewportOverflow(viewport);
6812
+ const viewportFit = useViewportFit(viewport);
6770
6813
  const startLeafColumns = table.getStartVisibleLeafColumns();
6771
6814
  const endLeafColumns = table.getEndVisibleLeafColumns();
6772
6815
  const displayColumns = [
@@ -6855,6 +6898,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
6855
6898
  leftOffset += width;
6856
6899
  }
6857
6900
  }
6901
+ varsMap["--ledger-pinned-start-width"] = `${leftOffset}px`;
6858
6902
  let rightOffset = 0;
6859
6903
  for (let index = visibleLeafColumns.length - 1; index >= 0; index -= 1) {
6860
6904
  const column = visibleLeafColumns[index];
@@ -7119,7 +7163,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
7119
7163
  ]);
7120
7164
  const activeRowAnnouncer = useRef(null);
7121
7165
  const rowNavigationHintId = `${instanceId}-row-navigation`;
7122
- const viewportFocusStop = activeRowEnabled || viewportOverflows;
7166
+ const viewportFocusStop = activeRowEnabled || viewportFit.overflowing;
7123
7167
  const viewportDescribedBy = activeRowEnabled ? [viewportProps?.["aria-describedby"], rowNavigationHintId].filter(Boolean).join(" ") : viewportProps?.["aria-describedby"];
7124
7168
  const announceActiveRow = useEventCallback(() => {
7125
7169
  const target = activeRowAnnouncer.current;
@@ -7229,7 +7273,8 @@ function DataTableCore({ presentation, stylesProps, table }) {
7229
7273
  width: columnWidths.total > 0 ? columnWidths.total : void 0,
7230
7274
  minWidth: toPx(tableMinWidth),
7231
7275
  borderCollapse: "separate",
7232
- borderSpacing: 0
7276
+ borderSpacing: 0,
7277
+ fontSize: "inherit"
7233
7278
  } });
7234
7279
  const rowOrderingEnabled = ledger?.rowOrdering.enabled === true;
7235
7280
  const nameReorderRow = useEventCallback((row) => {
@@ -7309,6 +7354,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
7309
7354
  "data-scrolled-start": scrollEdges.start || void 0,
7310
7355
  "data-size": size,
7311
7356
  "data-striped": stripedMode,
7357
+ "data-underfilled": viewportFit.underfilled || void 0,
7312
7358
  "data-virtualized-columns": columnWindow !== null || void 0,
7313
7359
  "data-virtualized-rows": virtualEnabled || void 0,
7314
7360
  "data-with-bottom-border": withBottomBorder || void 0,
@@ -7489,13 +7535,15 @@ DataTable.SelectionBar = DataTableSelectionBar;
7489
7535
  * renderer over the public editing contexts (docs/editing.md#editors), which is the proof the
7490
7536
  * contexts suffice: anything these do, an application's own renderer can do the same way.
7491
7537
  * All are default-variant Mantine inputs at the context's `size` — the border marks the cell as an
7492
- * open editor, and the size keeps it inside the row.
7538
+ * open editor, and the size keeps it inside the row. The fields fill the cell (`flex={1}` in the
7539
+ * host's flex line); the checkbox keeps its own size, placed by the column's alignment.
7493
7540
  */
7494
7541
  const renderTextEditor = ({ value, setValue, error, pending, autoFocus, label, size }) => /* @__PURE__ */ jsx(TextInput, {
7495
7542
  "aria-label": label,
7496
7543
  autoFocus,
7497
7544
  disabled: pending,
7498
7545
  error,
7546
+ flex: 1,
7499
7547
  size,
7500
7548
  value: value === null || value === void 0 ? "" : String(value),
7501
7549
  onChange: (event) => setValue(event.currentTarget.value)
@@ -7512,6 +7560,7 @@ const renderNumberEditor = ({ value, setValue, error, pending, autoFocus, label,
7512
7560
  autoFocus,
7513
7561
  disabled: pending,
7514
7562
  error,
7563
+ flex: 1,
7515
7564
  size,
7516
7565
  value: typeof value === "number" || typeof value === "string" ? value : "",
7517
7566
  onChange: (next) => setValue(next === "" ? null : next)
@@ -7536,6 +7585,7 @@ function selectEditor(options) {
7536
7585
  defaultDropdownOpened: mode === "cell",
7537
7586
  disabled: pending,
7538
7587
  error,
7588
+ flex: 1,
7539
7589
  size,
7540
7590
  value: value === null || value === void 0 ? null : String(value),
7541
7591
  onChange: (next) => {