@bigbinary/neeto-atoms 1.0.46 → 1.0.48

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.
@@ -3254,12 +3254,13 @@ const getResizeColumnStyle = ({
3254
3254
  enableResize,
3255
3255
  pinned,
3256
3256
  pinnedStart,
3257
- pinnedEnd
3257
+ pinnedEnd,
3258
+ percentageWidth
3258
3259
  }) => ({
3259
- width: isLastDataCol ? void 0 : size,
3260
+ width: isLastDataCol ? void 0 : percentageWidth && !isSelectionCol ? percentageWidth : size,
3260
3261
  ...enableResize ? {
3261
3262
  minWidth: size,
3262
- ...!isSelectionCol && !isLastDataCol ? { maxWidth: size } : {}
3263
+ ...!isSelectionCol && !isLastDataCol && !percentageWidth ? { maxWidth: size } : {}
3263
3264
  } : {},
3264
3265
  ...pinned === "left" ? { left: pinnedStart } : {},
3265
3266
  ...pinned === "right" ? { right: pinnedEnd } : {}
@@ -3670,16 +3671,22 @@ const useColumnResize = ({
3670
3671
  };
3671
3672
  }, [enabled, scrollContainerRef]);
3672
3673
  React.useLayoutEffect(() => {
3673
- if (!enabled || containerWidth === 0) return;
3674
+ if (!enabled) return;
3675
+ const container = scrollContainerRef.current;
3676
+ const measuredWidth = Math.max(
3677
+ container ? Math.round(container.clientWidth) : 0,
3678
+ containerWidth
3679
+ );
3680
+ if (measuredWidth === 0) return;
3674
3681
  const leafColumns = table.getAllLeafColumns().filter((col) => col.id !== "_selection");
3675
3682
  let reservedWidth = 0;
3676
3683
  if (hasSelectionColumn) {
3677
- const firstTh = scrollContainerRef.current?.querySelector("thead th");
3684
+ const firstTh = container?.querySelector("thead th");
3678
3685
  if (firstTh) {
3679
3686
  reservedWidth = firstTh.getBoundingClientRect().width;
3680
3687
  }
3681
3688
  }
3682
- const availableWidth = containerWidth - reservedWidth;
3689
+ const availableWidth = measuredWidth - reservedWidth;
3683
3690
  let userResizedTotal = 0;
3684
3691
  let autoDefaultTotal = 0;
3685
3692
  const visibleIds = new Set(leafColumns.map((col) => col.id));
@@ -4226,6 +4233,8 @@ const DataTable = ({
4226
4233
  const leafColumns = table.getVisibleLeafColumns();
4227
4234
  const lastLeftPinnedId = leafColumns.filter((col) => col.getIsPinned() === "left").at(-1)?.id;
4228
4235
  const firstRightPinnedId = leafColumns.filter((col) => col.getIsPinned() === "right").at(0)?.id;
4236
+ const hasProportionalSizing = enableColumnResize && Object.keys(columnSizing).length > 0;
4237
+ const totalDefaultSize = hasProportionalSizing ? 0 : leafColumns.filter((col) => col.id !== "_selection").reduce((sum, col) => sum + (col.columnDef.size ?? 150), 0);
4229
4238
  return /* @__PURE__ */ jsxRuntime.jsxs("div", { className: utils.cn("relative flex min-h-0 w-full flex-col", className), children: [
4230
4239
  loading && /* @__PURE__ */ jsxRuntime.jsx(LoadingOverlay, {}),
4231
4240
  (showSelectAllCallout || showAllSelectedCallout) && /* @__PURE__ */ jsxRuntime.jsx(
@@ -4277,7 +4286,8 @@ const DataTable = ({
4277
4286
  enableResize: enableColumnResize,
4278
4287
  pinned: isPinned,
4279
4288
  pinnedStart: header.column.getStart("left"),
4280
- pinnedEnd: header.column.getAfter("right")
4289
+ pinnedEnd: header.column.getAfter("right"),
4290
+ percentageWidth: !hasProportionalSizing && totalDefaultSize > 0 ? `${(header.column.columnDef.size ?? 150) / totalDefaultSize * 100}%` : void 0
4281
4291
  }),
4282
4292
  onClick: header.column.getCanSort() ? header.column.getToggleSortingHandler() : void 0,
4283
4293
  children: [
@@ -4339,7 +4349,7 @@ const DataTable = ({
4339
4349
  {
4340
4350
  className: utils.cn(
4341
4351
  isSelCell && "!pe-2",
4342
- isPinned && "sticky z-10 bg-background group-hover:bg-muted/50 group-data-[state=selected]:bg-info",
4352
+ isPinned && "sticky z-10 bg-background group-hover:bg-muted group-data-[state=selected]:bg-info",
4343
4353
  cell.column.id === lastLeftPinnedId && "after:pointer-events-none after:absolute after:inset-y-0 after:-right-2 after:w-2 after:bg-gradient-to-r after:from-black/6 after:to-transparent after:opacity-0 after:transition-opacity after:duration-200 after:content-[''] group-data-[scrolled-start]/scroll:after:opacity-100 dark:after:from-white/6",
4344
4354
  cell.column.id === firstRightPinnedId && "before:pointer-events-none before:absolute before:inset-y-0 before:-left-2 before:w-2 before:bg-gradient-to-l before:from-black/6 before:to-transparent before:opacity-0 before:transition-opacity before:duration-200 before:content-[''] group-data-[scrolled-end]/scroll:before:opacity-100 dark:before:from-white/6"
4345
4355
  ),
@@ -4350,7 +4360,8 @@ const DataTable = ({
4350
4360
  enableResize: enableColumnResize,
4351
4361
  pinned: isPinned,
4352
4362
  pinnedStart: cell.column.getStart("left"),
4353
- pinnedEnd: cell.column.getAfter("right")
4363
+ pinnedEnd: cell.column.getAfter("right"),
4364
+ percentageWidth: !hasProportionalSizing && totalDefaultSize > 0 ? `${(cell.column.columnDef.size ?? 150) / totalDefaultSize * 100}%` : void 0
4354
4365
  }),
4355
4366
  children: flexRender(
4356
4367
  cell.column.columnDef.cell,
@@ -4384,4 +4395,4 @@ exports.useColumnVisibility = useColumnVisibility;
4384
4395
  exports.useTablePagination = useTablePagination;
4385
4396
  exports.useTableSelection = useTableSelection;
4386
4397
  exports.useTableSort = useTableSort;
4387
- //# sourceMappingURL=DataTable-buERtmN8.js.map
4398
+ //# sourceMappingURL=DataTable-CgQRfaIc.js.map