@coldsmirk/ledger-mantine 0.10.1 → 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.cjs CHANGED
@@ -452,8 +452,11 @@ function useRowReorder({ onRowReorder, labels, viewportRef, getCenterRows, nameR
452
452
  body.append(rowClone);
453
453
  ghostTable.append(colgroup, body);
454
454
  element.replaceChildren(ghostTable);
455
- const surface = getComputedStyle(source).getPropertyValue("--ledger-body-bg").trim();
456
- if (surface !== "") element.style.setProperty("--ledger-body-bg", surface);
455
+ const sourceStyle = getComputedStyle(source);
456
+ for (const variable of ["--ledger-body-bg", "--ledger-border-color"]) {
457
+ const value = sourceStyle.getPropertyValue(variable).trim();
458
+ if (value !== "") element.style.setProperty(variable, value);
459
+ }
457
460
  const rowRect = source.getBoundingClientRect();
458
461
  ghostOrigin.current = {
459
462
  x: rowRect.left - ghostPosition.current.x,
@@ -2836,7 +2839,10 @@ function DetailRow({ row, renderDetailPanel, colSpan, dragging, dropSide, last,
2836
2839
  colSpan,
2837
2840
  role: "cell",
2838
2841
  ...getStyles("detailPanel"),
2839
- children: renderDetailPanel?.(row)
2842
+ children: /* @__PURE__ */ (0, react_jsx_runtime.jsx)("div", {
2843
+ "data-detail-content": true,
2844
+ children: renderDetailPanel?.(row)
2845
+ })
2840
2846
  })
2841
2847
  });
2842
2848
  }
@@ -4217,11 +4223,18 @@ function minWidthPx(tableMinWidth, viewport) {
4217
4223
  return Number.parseFloat(getComputedStyle(tableElement).minWidth) || 0;
4218
4224
  }
4219
4225
  function useColumnWidths(table, { columns, viewport, tableMinWidth, injectedWidth, autosizeWidths }) {
4220
- const [availableWidth, setAvailableWidth] = (0, react.useState)(0);
4226
+ const [widths, setWidths] = (0, react.useState)({
4227
+ available: 0,
4228
+ viewport: 0
4229
+ });
4221
4230
  const measure = (0, react.useCallback)(() => {
4222
4231
  if (!viewport) return;
4223
- const next = Math.max(viewport.clientWidth, minWidthPx(tableMinWidth, viewport));
4224
- setAvailableWidth((previous) => previous === next ? previous : next);
4232
+ const inner = Math.max(0, Math.round(viewport.clientWidth));
4233
+ const available = Math.max(inner, minWidthPx(tableMinWidth, viewport));
4234
+ setWidths((previous) => previous.available === available && previous.viewport === inner ? previous : {
4235
+ available,
4236
+ viewport: inner
4237
+ });
4225
4238
  }, [viewport, tableMinWidth]);
4226
4239
  (0, react.useLayoutEffect)(() => {
4227
4240
  measure();
@@ -4249,11 +4262,11 @@ function useColumnWidths(table, { columns, viewport, tableMinWidth, injectedWidt
4249
4262
  minSize: raw ? raw.minSize ?? defaultColumn?.minSize : column.columnDef.minSize,
4250
4263
  maxSize: raw ? raw.maxSize ?? defaultColumn?.maxSize : column.columnDef.maxSize
4251
4264
  };
4252
- }), columnSizing, availableWidth);
4265
+ }), columnSizing, widths.available);
4253
4266
  }, [
4254
4267
  columns,
4255
4268
  columnSizing,
4256
- availableWidth,
4269
+ widths.available,
4257
4270
  defaultColumn,
4258
4271
  injectedWidth,
4259
4272
  autosizeWidths
@@ -4261,9 +4274,15 @@ function useColumnWidths(table, { columns, viewport, tableMinWidth, injectedWidt
4261
4274
  const signature = JSON.stringify([
4262
4275
  resolved.total,
4263
4276
  resolved.filler,
4277
+ widths.viewport,
4264
4278
  Object.entries(resolved.byId)
4265
4279
  ]);
4266
- return (0, react.useMemo)(() => resolved, [signature]);
4280
+ return (0, react.useMemo)(() => {
4281
+ return {
4282
+ ...resolved,
4283
+ viewportWidth: widths.viewport
4284
+ };
4285
+ }, [signature]);
4267
4286
  }
4268
4287
  //#endregion
4269
4288
  //#region src/ledger-features.ts
@@ -7272,6 +7291,7 @@ function DataTableCore({ presentation, stylesProps, table }) {
7272
7291
  }
7273
7292
  }
7274
7293
  varsMap["--ledger-pinned-start-width"] = `${leftOffset}px`;
7294
+ if (columnWidths.viewportWidth > 0) varsMap["--ledger-viewport-width"] = `${columnWidths.viewportWidth}px`;
7275
7295
  let rightOffset = 0;
7276
7296
  for (let index = visibleLeafColumns.length - 1; index >= 0; index -= 1) {
7277
7297
  const column = visibleLeafColumns[index];