@bigbinary/neeto-atoms 1.0.5 → 1.0.6

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/cjs/index.js CHANGED
@@ -59718,9 +59718,6 @@ function useReactTable(options) {
59718
59718
  return tableRef.current;
59719
59719
  }
59720
59720
 
59721
- function Table$1({ className, ...props }) {
59722
- return (jsxRuntime.jsx("div", { "data-slot": "table-container", className: "relative w-full overflow-x-auto", children: jsxRuntime.jsx("table", { "data-slot": "table", className: cn$1("w-full caption-bottom text-sm", className), ...props }) }));
59723
- }
59724
59721
  function TableHeader$1({ className, ...props }) {
59725
59722
  return (jsxRuntime.jsx("thead", { "data-slot": "table-header", className: cn$1("[&_tr]:border-b", className), ...props }));
59726
59723
  }
@@ -59743,10 +59740,10 @@ function TableCaption$1({ className, ...props }) {
59743
59740
  return (jsxRuntime.jsx("caption", { "data-slot": "table-caption", className: cn$1("mt-4 text-sm text-muted-foreground", className), ...props }));
59744
59741
  }
59745
59742
 
59746
- const Table = (props) => (jsxRuntime.jsx(Table$1, { ...props }));
59747
- const TableHeader = (props) => jsxRuntime.jsx(TableHeader$1, { ...props });
59743
+ const Table = ({ className, ...props }) => (jsxRuntime.jsx("div", { "data-slot": "table-container", className: "relative w-full", children: jsxRuntime.jsx("table", { "data-slot": "table", className: cn$1("w-full caption-bottom text-sm", className), ...props }) }));
59744
+ const TableHeader = (props) => (jsxRuntime.jsx(TableHeader$1, { ...props }));
59748
59745
  const TableBody = (props) => (jsxRuntime.jsx(TableBody$1, { ...props }));
59749
- const TableFooter = (props) => jsxRuntime.jsx(TableFooter$1, { ...props });
59746
+ const TableFooter = (props) => (jsxRuntime.jsx(TableFooter$1, { ...props }));
59750
59747
  const TableHead = (props) => (jsxRuntime.jsx(TableHead$1, { ...props }));
59751
59748
  const TableRow = (props) => (jsxRuntime.jsx(TableRow$1, { ...props }));
59752
59749
  const TableCell = (props) => (jsxRuntime.jsx(TableCell$1, { ...props }));
@@ -60147,7 +60144,7 @@ const BulkSelectCallout = ({ bulkSelectAllRowsProps, isAllPageRowsSelected, isBu
60147
60144
  if (!isAllPageRowsSelected)
60148
60145
  return null;
60149
60146
  const { selectAllRowMessage, selectAllRowButtonLabel, setBulkSelectedAllRows, allRowsSelectedMessage, clearSelectionButtonLabel, } = bulkSelectAllRowsProps;
60150
- return (jsxRuntime.jsx("div", { className: "flex items-center justify-center gap-2 border-b bg-muted/50 px-4 py-2 text-sm", children: isBulkAllSelected ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { children: allRowsSelectedMessage ?? selectAllRowMessage }), clearSelectionButtonLabel && (jsxRuntime.jsx(Button$1, { variant: "link", onClick: () => setBulkSelectedAllRows(false), children: clearSelectionButtonLabel }))] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { children: selectAllRowMessage }), jsxRuntime.jsx(Button$1, { variant: "link", onClick: () => setBulkSelectedAllRows(true), children: selectAllRowButtonLabel })] })) }));
60147
+ return (jsxRuntime.jsx("div", { className: "mb-2 flex items-center justify-center gap-1 rounded-lg bg-primary/10 px-4 py-1.5 text-sm text-primary", children: isBulkAllSelected ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { children: allRowsSelectedMessage ?? selectAllRowMessage }), clearSelectionButtonLabel && (jsxRuntime.jsx(Button$1, { variant: "link", onClick: () => setBulkSelectedAllRows(false), children: clearSelectionButtonLabel }))] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { children: selectAllRowMessage }), jsxRuntime.jsx(Button$1, { variant: "link", onClick: () => setBulkSelectedAllRows(true), children: selectAllRowButtonLabel })] })) }));
60151
60148
  };
60152
60149
 
60153
60150
  function Pagination$1({ className, ...props }) {
@@ -60287,7 +60284,7 @@ const HeaderCellMenu = ({ column, enableAddColumn, enableColumnFreeze, isColumnP
60287
60284
  }) }))] })] }) }));
60288
60285
  };
60289
60286
 
60290
- const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp, onSortingChange: onSortingChangeProp, enableSorting = true, enableURLSort = true, totalCount, pageSize = DEFAULT_PAGE_SIZE, currentPage: currentPageProp, onPageChange: onPageChangeProp, enableURLPagination = true, enableRowSelection: enableRowSelectionProp, selectedRowKeys, onRowSelect, bulkSelectAllRowsProps, enableColumnResize = true, enableColumnFreeze = true, columnPinning: columnPinningProp, onColumnPinningChange: onColumnPinningChangeProp, localStorageKeyPrefix, columnVisibility: columnVisibilityProp, onColumnVisibilityChange: onColumnVisibilityChangeProp, onColumnHide: onColumnHideProp, enableColumnReorder = false, columnOrder: columnOrderProp, onColumnOrderChange: onColumnOrderChangeProp, enableAddColumn = false, onColumnAdd, onColumnDelete, onColumnUpdate, onMoreActionClick, enableHeaderMenu, loading = false, fixedHeight = false, bordered = true, className, scroll, emptyMessage, onRowClick, allowRowClick = true, }) => {
60287
+ const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp, onSortingChange: onSortingChangeProp, enableSorting = true, enableURLSort = true, totalCount, pageSize = DEFAULT_PAGE_SIZE, currentPage: currentPageProp, onPageChange: onPageChangeProp, enableURLPagination = true, enableRowSelection: enableRowSelectionProp, selectedRowKeys, onRowSelect, bulkSelectAllRowsProps, enableColumnResize = true, enableColumnFreeze = true, columnPinning: columnPinningProp, onColumnPinningChange: onColumnPinningChangeProp, localStorageKeyPrefix, columnVisibility: columnVisibilityProp, onColumnVisibilityChange: onColumnVisibilityChangeProp, onColumnHide: onColumnHideProp, enableColumnReorder = false, columnOrder: columnOrderProp, onColumnOrderChange: onColumnOrderChangeProp, enableAddColumn = false, onColumnAdd, onColumnDelete, onColumnUpdate, onMoreActionClick, enableHeaderMenu, loading = false, bordered = true, className, emptyMessage, onRowClick, allowRowClick = true, }) => {
60291
60288
  const getRowId = React.useMemo(() => getRowIdProp ??
60292
60289
  ((row) => row.id), [getRowIdProp]);
60293
60290
  const { sorting, onSortingChange } = useTableSort({
@@ -60346,6 +60343,14 @@ const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp
60346
60343
  }
60347
60344
  return columnOrder;
60348
60345
  }, [columnOrder, selectionColumn]);
60346
+ const resolvedColumnPinning = React.useMemo(() => {
60347
+ if (!selectionColumn || !enableColumnFreeze)
60348
+ return columnPinning;
60349
+ const left = columnPinning.left ?? [];
60350
+ if (left.includes("_selection"))
60351
+ return columnPinning;
60352
+ return { ...columnPinning, left: ["_selection", ...left] };
60353
+ }, [columnPinning, selectionColumn, enableColumnFreeze]);
60349
60354
  const table = useReactTable({
60350
60355
  data,
60351
60356
  columns: allColumns,
@@ -60357,7 +60362,7 @@ const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp
60357
60362
  sorting,
60358
60363
  pagination: paginationState,
60359
60364
  rowSelection,
60360
- columnPinning,
60365
+ columnPinning: resolvedColumnPinning,
60361
60366
  columnVisibility,
60362
60367
  columnOrder: resolvedColumnOrder,
60363
60368
  },
@@ -60385,17 +60390,7 @@ const DataTable = ({ columns, data, getRowId: getRowIdProp, sorting: sortingProp
60385
60390
  onSortingChange([{ id: columnId, desc }]);
60386
60391
  }
60387
60392
  };
60388
- const scrollStyle = {};
60389
- if (scroll?.x) {
60390
- scrollStyle.minWidth =
60391
- typeof scroll.x === "number" ? `${scroll.x}px` : scroll.x;
60392
- }
60393
- if (scroll?.y) {
60394
- scrollStyle.maxHeight =
60395
- typeof scroll.y === "number" ? `${scroll.y}px` : scroll.y;
60396
- scrollStyle.overflowY = "auto";
60397
- }
60398
- return (jsxRuntime.jsxs("div", { className: cn$1("relative w-full", fixedHeight && "flex flex-1 flex-col overflow-hidden", className), children: [loading && jsxRuntime.jsx(LoadingOverlay, {}), bulkSelectAllRowsProps && (jsxRuntime.jsx(BulkSelectCallout, { bulkSelectAllRowsProps: bulkSelectAllRowsProps, isAllPageRowsSelected: table.getIsAllPageRowsSelected(), isBulkAllSelected: isBulkAllSelected })), jsxRuntime.jsx("div", { className: cn$1("overflow-auto", fixedHeight && "flex-1", bordered && "overflow-hidden rounded-lg border"), style: scrollStyle, children: jsxRuntime.jsxs(Table, { style: scroll?.x ? { minWidth: scrollStyle.minWidth } : undefined, children: [jsxRuntime.jsx(TableHeader, { className: "bg-muted", children: table.getHeaderGroups().map(headerGroup => (jsxRuntime.jsx(TableRow, { className: "hover:bg-muted", children: headerGroup.headers.map((header, headerIndex) => {
60393
+ return (jsxRuntime.jsxs("div", { className: cn$1("relative flex min-h-0 w-full flex-col", className), children: [loading && jsxRuntime.jsx(LoadingOverlay, {}), bulkSelectAllRowsProps && (jsxRuntime.jsx(BulkSelectCallout, { bulkSelectAllRowsProps: bulkSelectAllRowsProps, isAllPageRowsSelected: table.getIsAllPageRowsSelected(), isBulkAllSelected: isBulkAllSelected })), jsxRuntime.jsx("div", { className: cn$1("min-h-0 flex-1 overflow-auto", bordered && "rounded-lg border"), children: jsxRuntime.jsxs(Table, { children: [jsxRuntime.jsx(TableHeader, { className: "sticky top-0 z-20 bg-muted", children: table.getHeaderGroups().map(headerGroup => (jsxRuntime.jsx(TableRow, { className: "hover:bg-muted", children: headerGroup.headers.map((header, headerIndex) => {
60399
60394
  const isPinned = header.column.getIsPinned();
60400
60395
  const isSelectionCol = header.column.id === "_selection";
60401
60396
  const visibleHeaders = headerGroup.headers.filter(h => h.column.id !== "_selection");