@bigbinary/neeto-atoms 1.0.47 → 1.0.49

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.
@@ -3233,12 +3233,13 @@ const getResizeColumnStyle = ({
3233
3233
  enableResize,
3234
3234
  pinned,
3235
3235
  pinnedStart,
3236
- pinnedEnd
3236
+ pinnedEnd,
3237
+ percentageWidth
3237
3238
  }) => ({
3238
- width: isLastDataCol ? void 0 : size,
3239
+ width: isLastDataCol ? void 0 : percentageWidth && !isSelectionCol ? percentageWidth : size,
3239
3240
  ...enableResize ? {
3240
3241
  minWidth: size,
3241
- ...!isSelectionCol && !isLastDataCol ? { maxWidth: size } : {}
3242
+ ...!isSelectionCol && !isLastDataCol && !percentageWidth ? { maxWidth: size } : {}
3242
3243
  } : {},
3243
3244
  ...pinned === "left" ? { left: pinnedStart } : {},
3244
3245
  ...pinned === "right" ? { right: pinnedEnd } : {}
@@ -3649,16 +3650,22 @@ const useColumnResize = ({
3649
3650
  };
3650
3651
  }, [enabled, scrollContainerRef]);
3651
3652
  useLayoutEffect(() => {
3652
- if (!enabled || containerWidth === 0) return;
3653
+ if (!enabled) return;
3654
+ const container = scrollContainerRef.current;
3655
+ const measuredWidth = Math.max(
3656
+ container ? Math.round(container.clientWidth) : 0,
3657
+ containerWidth
3658
+ );
3659
+ if (measuredWidth === 0) return;
3653
3660
  const leafColumns = table.getAllLeafColumns().filter((col) => col.id !== "_selection");
3654
3661
  let reservedWidth = 0;
3655
3662
  if (hasSelectionColumn) {
3656
- const firstTh = scrollContainerRef.current?.querySelector("thead th");
3663
+ const firstTh = container?.querySelector("thead th");
3657
3664
  if (firstTh) {
3658
3665
  reservedWidth = firstTh.getBoundingClientRect().width;
3659
3666
  }
3660
3667
  }
3661
- const availableWidth = containerWidth - reservedWidth;
3668
+ const availableWidth = measuredWidth - reservedWidth;
3662
3669
  let userResizedTotal = 0;
3663
3670
  let autoDefaultTotal = 0;
3664
3671
  const visibleIds = new Set(leafColumns.map((col) => col.id));
@@ -4205,6 +4212,8 @@ const DataTable = ({
4205
4212
  const leafColumns = table.getVisibleLeafColumns();
4206
4213
  const lastLeftPinnedId = leafColumns.filter((col) => col.getIsPinned() === "left").at(-1)?.id;
4207
4214
  const firstRightPinnedId = leafColumns.filter((col) => col.getIsPinned() === "right").at(0)?.id;
4215
+ const hasProportionalSizing = enableColumnResize && Object.keys(columnSizing).length > 0;
4216
+ const totalDefaultSize = hasProportionalSizing ? 0 : leafColumns.filter((col) => col.id !== "_selection").reduce((sum, col) => sum + (col.columnDef.size ?? 150), 0);
4208
4217
  return /* @__PURE__ */ jsxs("div", { className: cn("relative flex min-h-0 w-full flex-col", className), children: [
4209
4218
  loading && /* @__PURE__ */ jsx(LoadingOverlay, {}),
4210
4219
  (showSelectAllCallout || showAllSelectedCallout) && /* @__PURE__ */ jsx(
@@ -4256,7 +4265,8 @@ const DataTable = ({
4256
4265
  enableResize: enableColumnResize,
4257
4266
  pinned: isPinned,
4258
4267
  pinnedStart: header.column.getStart("left"),
4259
- pinnedEnd: header.column.getAfter("right")
4268
+ pinnedEnd: header.column.getAfter("right"),
4269
+ percentageWidth: !hasProportionalSizing && totalDefaultSize > 0 ? `${(header.column.columnDef.size ?? 150) / totalDefaultSize * 100}%` : void 0
4260
4270
  }),
4261
4271
  onClick: header.column.getCanSort() ? header.column.getToggleSortingHandler() : void 0,
4262
4272
  children: [
@@ -4329,7 +4339,8 @@ const DataTable = ({
4329
4339
  enableResize: enableColumnResize,
4330
4340
  pinned: isPinned,
4331
4341
  pinnedStart: cell.column.getStart("left"),
4332
- pinnedEnd: cell.column.getAfter("right")
4342
+ pinnedEnd: cell.column.getAfter("right"),
4343
+ percentageWidth: !hasProportionalSizing && totalDefaultSize > 0 ? `${(cell.column.columnDef.size ?? 150) / totalDefaultSize * 100}%` : void 0
4333
4344
  }),
4334
4345
  children: flexRender(
4335
4346
  cell.column.columnDef.cell,
@@ -4357,4 +4368,4 @@ const DataTable = ({
4357
4368
  };
4358
4369
 
4359
4370
  export { DataTable as D, useColumnPinning as a, useColumnVisibility as b, useTablePagination as c, useTableSelection as d, useTableSort as e, useColumnOrdering as u };
4360
- //# sourceMappingURL=DataTable-DX5y8WcM.js.map
4371
+ //# sourceMappingURL=DataTable-CHxdhAU2.js.map