@trackunit/react-table 2.11.17 → 2.12.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/index.cjs.js CHANGED
@@ -354,9 +354,9 @@ const ActionContainerAndOverflow = ({ actions, dropdownActions, moreActions, "da
354
354
  * @param {ActionSheetProps} props - The props for the ActionSheet component
355
355
  * @returns {ReactElement} ActionSheet component
356
356
  */
357
- const ActionSheet = ({ actions, dropdownActions, moreActions = [], selections, resetSelection, className, style, "data-testid": dataTestId, }) => {
357
+ const ActionSheet = ({ actions, dropdownActions, moreActions = [], selections, resetSelection, className, style, "data-testid": dataTestId, ref, }) => {
358
358
  const [t] = useTranslation();
359
- return (jsxRuntime.jsxs("div", { className: cvaActionSheet({ className }), "data-testid": dataTestId, style: style, children: [jsxRuntime.jsx(reactComponents.Button, { className: "row-start-1", "data-testid": "XButton",
359
+ return (jsxRuntime.jsxs("div", { className: cvaActionSheet({ className }), "data-testid": dataTestId, ref: ref, style: style, children: [jsxRuntime.jsx(reactComponents.Button, { className: "row-start-1", "data-testid": "XButton",
360
360
  // eslint-disable-next-line @trackunit/prefer-event-specific-callback-naming
361
361
  onClick: resetSelection, prefix: jsxRuntime.jsx(reactComponents.Icon, { color: "white", "data-testid": "close-icon", name: "XMark", size: "small" }), children: t("table.actionsheet.selected", { count: selections.length }) }), jsxRuntime.jsx(reactComponents.Spacer, { border: true, className: cvaDivider() }), jsxRuntime.jsx(ActionContainerAndOverflow, { "data-testid": dataTestId,
362
362
  actions,
@@ -866,7 +866,7 @@ const ColumnFiltersDragAndDrop = ({ columns, setColumnOrder, onUserEvent, isSort
866
866
  * @param {SortingProps<TSorting, TSortingValue>} props - The props object containing sorting properties.
867
867
  * @returns {ReactElement | null} A React JSX element representing the Sorting component or null if there are no sortable columns.
868
868
  */
869
- const Sorting = ({ columns, }) => {
869
+ const Sorting = ({ columns, className, "data-testid": dataTestId, style, ref, }) => {
870
870
  const [t] = useTranslation();
871
871
  const sortableColumns = columns.filter(column => column.getCanSort());
872
872
  const sortedColumn = sortableColumns.find(column => column.getIsSorted() !== false);
@@ -886,7 +886,7 @@ const Sorting = ({ columns, }) => {
886
886
  const chosenColumn = sortableColumns.find(column => column.id === currentSortValue);
887
887
  chosenColumn?.toggleSorting(selectedValue === "desc");
888
888
  };
889
- return (jsxRuntime.jsx(reactComponents.Tooltip, { label: t("table.sorting.toolip"), placement: "bottom", children: jsxRuntime.jsxs(reactComponents.Popover, { placement: "bottom-start", children: [jsxRuntime.jsx(reactComponents.PopoverTrigger, { children: jsxRuntime.jsx(reactComponents.Button, { prefix: currentSortDirection === "asc" ? (jsxRuntime.jsx(reactComponents.Icon, { name: "BarsArrowUp", size: "small" })) : (jsxRuntime.jsx(reactComponents.Icon, { name: "BarsArrowDown", size: "small" })), size: "small", variant: "ghost-neutral", children: jsxRuntime.jsx("span", { className: "hidden sm:block", children: t("table.sorting.label") }) }) }), jsxRuntime.jsx(reactComponents.PopoverContent, { children: jsxRuntime.jsx("div", { className: reactComponents.cvaMenu({ className: "max-h-[55vh] overflow-y-auto", limitWidth: true }), children: jsxRuntime.jsxs("div", { className: reactComponents.cvaMenuList(), children: [jsxRuntime.jsx(reactFormComponents.RadioGroup, { id: "sortProperty", onChange: handleSelectionChange, value: currentSortValue ?? "", children: sortableColumns.map(column => (jsxRuntime.jsx(reactFormComponents.RadioItem, { className: "w-full", label: column.columnDef.header?.toString() ?? "", value: column.id }, column.id))) }), jsxRuntime.jsxs(reactFormComponents.RadioGroup, { id: "sortOrder", onChange: onSelectOrder, value: currentSortDirection, children: [jsxRuntime.jsx(reactFormComponents.RadioItem, { className: "w-full", label: t("table.sorting.ascending"), value: "asc" }), jsxRuntime.jsx(reactFormComponents.RadioItem, { className: "w-full", label: t("table.sorting.descending"), value: "desc" })] })] }) }) })] }) }));
889
+ return (jsxRuntime.jsx(reactComponents.Tooltip, { label: t("table.sorting.toolip"), placement: "bottom", children: jsxRuntime.jsxs(reactComponents.Popover, { placement: "bottom-start", children: [jsxRuntime.jsx(reactComponents.PopoverTrigger, { ref: ref, children: jsxRuntime.jsx(reactComponents.Button, { className: className, "data-testid": dataTestId, prefix: currentSortDirection === "asc" ? (jsxRuntime.jsx(reactComponents.Icon, { name: "BarsArrowUp", size: "small" })) : (jsxRuntime.jsx(reactComponents.Icon, { name: "BarsArrowDown", size: "small" })), size: "small", style: style, variant: "ghost-neutral", children: jsxRuntime.jsx("span", { className: "hidden sm:block", children: t("table.sorting.label") }) }) }), jsxRuntime.jsx(reactComponents.PopoverContent, { children: jsxRuntime.jsx("div", { className: reactComponents.cvaMenu({ className: "max-h-[55vh] overflow-y-auto", limitWidth: true }), children: jsxRuntime.jsxs("div", { className: reactComponents.cvaMenuList(), children: [jsxRuntime.jsx(reactFormComponents.RadioGroup, { id: "sortProperty", onChange: handleSelectionChange, value: currentSortValue ?? "", children: sortableColumns.map(column => (jsxRuntime.jsx(reactFormComponents.RadioItem, { className: "w-full", label: column.columnDef.header?.toString() ?? "", value: column.id }, column.id))) }), jsxRuntime.jsxs(reactFormComponents.RadioGroup, { id: "sortOrder", onChange: onSelectOrder, value: currentSortDirection, children: [jsxRuntime.jsx(reactFormComponents.RadioItem, { className: "w-full", label: t("table.sorting.ascending"), value: "asc" }), jsxRuntime.jsx(reactFormComponents.RadioItem, { className: "w-full", label: t("table.sorting.descending"), value: "desc" })] })] }) }) })] }) }));
890
890
  };
891
891
 
892
892
  /**
@@ -934,9 +934,9 @@ const Sorting = ({ columns, }) => {
934
934
  * />
935
935
  * ```
936
936
  */
937
- const SelectAllBanner = ({ areAllSelected, selectedCount, onClickSelectAll, onClickClearSelection, selectAllLabel, style, }) => {
937
+ const SelectAllBanner = ({ areAllSelected, selectedCount, onClickSelectAll, onClickClearSelection, selectAllLabel, className, "data-testid": dataTestId = "select-all-banner", style, ref, }) => {
938
938
  const [t] = useTranslation();
939
- return (jsxRuntime.jsx("div", { className: "flex w-full items-center justify-center gap-1 border-y border-neutral-200 bg-neutral-100 px-4 py-2 text-xs", "data-testid": "select-all-banner", style: style, children: areAllSelected ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "text-neutral-600", children: jsxRuntime.jsx(Trans, { components: { strong: jsxRuntime.jsx("span", { className: "font-medium" }) }, i18nKey: "table.selectAll.allSelected", values: { totalCount: selectedCount } }) }), jsxRuntime.jsx(reactComponents.Button, { onClick: onClickClearSelection, size: "small", variant: "ghost", children: t("table.selectAll.clearSelection") })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "text-neutral-600", children: jsxRuntime.jsx(Trans, { components: { strong: jsxRuntime.jsx("span", { className: "font-medium" }) }, i18nKey: "table.selectAll.pageSelected", values: { count: selectedCount } }) }), jsxRuntime.jsx(reactComponents.Button, { onClick: onClickSelectAll, size: "small", variant: "ghost", children: selectAllLabel ?? t("table.selectAll.selectAll") })] })) }));
939
+ return (jsxRuntime.jsx("div", { className: cssClassVarianceUtilities.cx("flex w-full items-center justify-center gap-1 border-y border-neutral-200 bg-neutral-100 px-4 py-2 text-xs", className), "data-testid": dataTestId, ref: ref, style: style, children: areAllSelected ? (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "text-neutral-600", children: jsxRuntime.jsx(Trans, { components: { strong: jsxRuntime.jsx("span", { className: "font-medium" }) }, i18nKey: "table.selectAll.allSelected", values: { totalCount: selectedCount } }) }), jsxRuntime.jsx(reactComponents.Button, { onClick: onClickClearSelection, size: "small", variant: "ghost", children: t("table.selectAll.clearSelection") })] })) : (jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [jsxRuntime.jsx("span", { className: "text-neutral-600", children: jsxRuntime.jsx(Trans, { components: { strong: jsxRuntime.jsx("span", { className: "font-medium" }) }, i18nKey: "table.selectAll.pageSelected", values: { count: selectedCount } }) }), jsxRuntime.jsx(reactComponents.Button, { onClick: onClickSelectAll, size: "small", variant: "ghost", children: selectAllLabel ?? t("table.selectAll.selectAll") })] })) }));
940
940
  };
941
941
 
942
942
  /**
@@ -1501,7 +1501,7 @@ const Table = ({ rowHeight = 50, loading = false, hideFooter = false, style, ref
1501
1501
  header.column.getToggleSortingHandler()?.(event);
1502
1502
  }
1503
1503
  }, [props]);
1504
- return (jsxRuntime.jsxs(reactComponents.Card, { className: tailwindMerge.twMerge("table-compact flex flex-col overflow-hidden", props.className), "data-testid": props["data-testid"], ref: ref, style: style, children: [sharedUtils.nonNullable(props.headerLeftActions) || sharedUtils.nonNullable(props.headerRightActions) ? (jsxRuntime.jsxs("div", { className: "flex-wrap-reverse-readable items-center gap-2 p-2", children: [sharedUtils.nonNullable(props.headerLeftActions) ? (jsxRuntime.jsx(reactComponents.HorizontalOverflowScroller, { className: "w-auto min-w-0", children: jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.headerLeftActions }) })) : null, sharedUtils.nonNullable(props.headerRightActions) ? (jsxRuntime.jsx(reactComponents.HorizontalOverflowScroller, { className: "ml-auto w-auto min-w-0", children: jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.headerRightActions }) })) : null] })) : null, props.subHeaderActions, jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("h-full overflow-x-auto overflow-y-scroll border-b border-neutral-200", (sharedUtils.nonNullable(props.headerLeftActions) || sharedUtils.nonNullable(props.headerRightActions)) &&
1504
+ return (jsxRuntime.jsxs(reactComponents.Card, { className: tailwindMerge.twMerge("table-compact flex flex-col overflow-hidden", props.className), "data-testid": props["data-testid"], ref: ref, style: style, children: [sharedUtils.nonNullable(props.headerLeftActions) || sharedUtils.nonNullable(props.headerRightActions) ? (jsxRuntime.jsxs("div", { className: "flex-wrap-reverse-readable items-center gap-2 p-2", children: [sharedUtils.nonNullable(props.headerLeftActions) ? (jsxRuntime.jsx(reactComponents.HorizontalOverflowScroller, { className: "w-auto min-w-0", children: jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.headerLeftActions }) })) : null, sharedUtils.nonNullable(props.headerRightActions) ? (jsxRuntime.jsx(reactComponents.HorizontalOverflowScroller, { className: "ml-auto w-auto min-w-0", children: jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.headerRightActions }) })) : null] })) : null, props.subHeaderActions, jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("z-default h-full overflow-x-auto overflow-y-scroll border-b border-neutral-200", (sharedUtils.nonNullable(props.headerLeftActions) || sharedUtils.nonNullable(props.headerRightActions)) &&
1505
1505
  !sharedUtils.nonNullable(props.subHeaderActions)
1506
1506
  ? "border-t"
1507
1507
  : ""), ref: tableScrollElementRef, children: jsxRuntime.jsxs(reactTableBaseComponents.TableRoot, { style: {
@@ -1598,15 +1598,13 @@ const Table = ({ rowHeight = 50, loading = false, hideFooter = false, style, ref
1598
1598
  }
1599
1599
  }) })) : (jsxRuntime.jsx("tbody", { className: cvaTBody({
1600
1600
  emptyState: !loading && (props.noDataMessage === undefined || props.noDataMessage === ""),
1601
- }), children: jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { className: "b-0", children: loading ? (jsxRuntime.jsx(reactComponents.Spinner, { centering: "centered", containerClassName: "absolute inset-0", "data-testid": "table-loading-spinner" })) : props.noDataMessage !== undefined && props.noDataMessage !== "" ? (props.noDataMessage) : (jsxRuntime.jsx(reactComponents.EmptyState, { className: "absolute inset-0", description: t("table.noResults"), image: "SEARCH_DOCUMENT", ...props.emptyState })) }) }) }))] }) }), hideFooter ? null : (jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2 p-2", "data-testid": "table-footer", children: [jsxRuntime.jsx("div", { className: "whitespace-nowrap text-xs font-medium text-neutral-600", children: loading && !hasResults ? (jsxRuntime.jsx(reactComponents.SkeletonLabel, { "data-testid": "table-footer-count-loading", flexibleWidth: false, textSize: "text-xs", width: "9rem" })) : typeof props.pagination?.pageInfo?.count === "number"
1602
- ? t(props.pagination.pageInfo.isCountCapped ? "table.pagination.full.capped" : "table.pagination.full", {
1603
- count: props.getRowModel().rows.length,
1604
- total: props.pagination.pageInfo.count,
1605
- })
1606
- : t(props.pagination?.pageInfo?.hasNextPage ? "table.pagination.full.capped" : "table.pagination.full", {
1607
- count: props.getRowModel().rows.length,
1608
- total: props.getRowModel().rows.length,
1609
- }) }), props.pagination?.isLoading && hasResults ? (jsxRuntime.jsx("span", { children: jsxRuntime.jsx(reactComponents.Spinner, { size: "small" }) })) : null, sharedUtils.nonNullable(props.footerRightActions) ? (jsxRuntime.jsx(reactComponents.HorizontalOverflowScroller, { className: "ml-auto w-auto min-w-0", children: jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.footerRightActions }) })) : null] }))] }));
1601
+ }), children: jsxRuntime.jsx("tr", { children: jsxRuntime.jsx("td", { className: "b-0", children: loading ? (jsxRuntime.jsx(reactComponents.Spinner, { centering: "centered", containerClassName: "absolute inset-0", "data-testid": "table-loading-spinner" })) : props.noDataMessage !== undefined && props.noDataMessage !== "" ? (props.noDataMessage) : (jsxRuntime.jsx(reactComponents.EmptyState, { className: "absolute inset-0", description: t("table.noResults"), image: "SEARCH_DOCUMENT", ...props.emptyState })) }) }) }))] }) }), hideFooter ? null : (jsxRuntime.jsxs("div", { className: "flex flex-wrap items-center gap-2 p-2", "data-testid": "table-footer", children: [jsxRuntime.jsx("div", { className: "whitespace-nowrap text-xs font-medium text-neutral-600", children: loading && !hasResults ? (jsxRuntime.jsx(reactComponents.SkeletonLabel, { "data-testid": "table-footer-count-loading", flexibleWidth: false, textSize: "text-xs", width: "9rem" })) : typeof props.pagination?.pageInfo?.count === "number" ? (t(props.pagination.pageInfo.isCountCapped ? "table.pagination.full.capped" : "table.pagination.full", {
1602
+ count: props.getRowModel().rows.length,
1603
+ total: props.pagination.pageInfo.count,
1604
+ })) : (t(props.pagination?.pageInfo?.hasNextPage ? "table.pagination.full.capped" : "table.pagination.full", {
1605
+ count: props.getRowModel().rows.length,
1606
+ total: props.getRowModel().rows.length,
1607
+ })) }), props.pagination?.isLoading && hasResults ? (jsxRuntime.jsx("span", { children: jsxRuntime.jsx(reactComponents.Spinner, { size: "small" }) })) : null, sharedUtils.nonNullable(props.footerRightActions) ? (jsxRuntime.jsx(reactComponents.HorizontalOverflowScroller, { className: "ml-auto w-auto min-w-0", children: jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.footerRightActions }) })) : null] }))] }));
1610
1608
  };
1611
1609
  const cvaTBody = cssClassVarianceUtilities.cva({
1612
1610
  base: ["min-h-[40dvh]"],
package/index.esm.js CHANGED
@@ -4,7 +4,7 @@ import { Icon, MenuItem, Button, Tooltip, useOverflowItems, MoreMenu, MenuConten
4
4
  import { Link } from '@tanstack/react-router';
5
5
  import { objectValues, VISIBLE_ONLY_COLUMN_VISIBILITY_KEY, objectKeys, nonNullable, objectEntries } from '@trackunit/shared-utils';
6
6
  import { useMemo, Children, cloneElement, useRef, useEffect, useState, useCallback, createElement } from 'react';
7
- import { cva } from '@trackunit/css-class-variance-utilities';
7
+ import { cva, cx } from '@trackunit/css-class-variance-utilities';
8
8
  import { useCurrentUser } from '@trackunit/react-core-hooks';
9
9
  import { z } from 'zod';
10
10
  import { cvaLabel, ToggleSwitch, Search, RadioGroup, RadioItem, Checkbox } from '@trackunit/react-form-components';
@@ -353,9 +353,9 @@ const ActionContainerAndOverflow = ({ actions, dropdownActions, moreActions, "da
353
353
  * @param {ActionSheetProps} props - The props for the ActionSheet component
354
354
  * @returns {ReactElement} ActionSheet component
355
355
  */
356
- const ActionSheet = ({ actions, dropdownActions, moreActions = [], selections, resetSelection, className, style, "data-testid": dataTestId, }) => {
356
+ const ActionSheet = ({ actions, dropdownActions, moreActions = [], selections, resetSelection, className, style, "data-testid": dataTestId, ref, }) => {
357
357
  const [t] = useTranslation();
358
- return (jsxs("div", { className: cvaActionSheet({ className }), "data-testid": dataTestId, style: style, children: [jsx(Button, { className: "row-start-1", "data-testid": "XButton",
358
+ return (jsxs("div", { className: cvaActionSheet({ className }), "data-testid": dataTestId, ref: ref, style: style, children: [jsx(Button, { className: "row-start-1", "data-testid": "XButton",
359
359
  // eslint-disable-next-line @trackunit/prefer-event-specific-callback-naming
360
360
  onClick: resetSelection, prefix: jsx(Icon, { color: "white", "data-testid": "close-icon", name: "XMark", size: "small" }), children: t("table.actionsheet.selected", { count: selections.length }) }), jsx(Spacer, { border: true, className: cvaDivider() }), jsx(ActionContainerAndOverflow, { "data-testid": dataTestId,
361
361
  actions,
@@ -865,7 +865,7 @@ const ColumnFiltersDragAndDrop = ({ columns, setColumnOrder, onUserEvent, isSort
865
865
  * @param {SortingProps<TSorting, TSortingValue>} props - The props object containing sorting properties.
866
866
  * @returns {ReactElement | null} A React JSX element representing the Sorting component or null if there are no sortable columns.
867
867
  */
868
- const Sorting = ({ columns, }) => {
868
+ const Sorting = ({ columns, className, "data-testid": dataTestId, style, ref, }) => {
869
869
  const [t] = useTranslation();
870
870
  const sortableColumns = columns.filter(column => column.getCanSort());
871
871
  const sortedColumn = sortableColumns.find(column => column.getIsSorted() !== false);
@@ -885,7 +885,7 @@ const Sorting = ({ columns, }) => {
885
885
  const chosenColumn = sortableColumns.find(column => column.id === currentSortValue);
886
886
  chosenColumn?.toggleSorting(selectedValue === "desc");
887
887
  };
888
- return (jsx(Tooltip, { label: t("table.sorting.toolip"), placement: "bottom", children: jsxs(Popover, { placement: "bottom-start", children: [jsx(PopoverTrigger, { children: jsx(Button, { prefix: currentSortDirection === "asc" ? (jsx(Icon, { name: "BarsArrowUp", size: "small" })) : (jsx(Icon, { name: "BarsArrowDown", size: "small" })), size: "small", variant: "ghost-neutral", children: jsx("span", { className: "hidden sm:block", children: t("table.sorting.label") }) }) }), jsx(PopoverContent, { children: jsx("div", { className: cvaMenu({ className: "max-h-[55vh] overflow-y-auto", limitWidth: true }), children: jsxs("div", { className: cvaMenuList(), children: [jsx(RadioGroup, { id: "sortProperty", onChange: handleSelectionChange, value: currentSortValue ?? "", children: sortableColumns.map(column => (jsx(RadioItem, { className: "w-full", label: column.columnDef.header?.toString() ?? "", value: column.id }, column.id))) }), jsxs(RadioGroup, { id: "sortOrder", onChange: onSelectOrder, value: currentSortDirection, children: [jsx(RadioItem, { className: "w-full", label: t("table.sorting.ascending"), value: "asc" }), jsx(RadioItem, { className: "w-full", label: t("table.sorting.descending"), value: "desc" })] })] }) }) })] }) }));
888
+ return (jsx(Tooltip, { label: t("table.sorting.toolip"), placement: "bottom", children: jsxs(Popover, { placement: "bottom-start", children: [jsx(PopoverTrigger, { ref: ref, children: jsx(Button, { className: className, "data-testid": dataTestId, prefix: currentSortDirection === "asc" ? (jsx(Icon, { name: "BarsArrowUp", size: "small" })) : (jsx(Icon, { name: "BarsArrowDown", size: "small" })), size: "small", style: style, variant: "ghost-neutral", children: jsx("span", { className: "hidden sm:block", children: t("table.sorting.label") }) }) }), jsx(PopoverContent, { children: jsx("div", { className: cvaMenu({ className: "max-h-[55vh] overflow-y-auto", limitWidth: true }), children: jsxs("div", { className: cvaMenuList(), children: [jsx(RadioGroup, { id: "sortProperty", onChange: handleSelectionChange, value: currentSortValue ?? "", children: sortableColumns.map(column => (jsx(RadioItem, { className: "w-full", label: column.columnDef.header?.toString() ?? "", value: column.id }, column.id))) }), jsxs(RadioGroup, { id: "sortOrder", onChange: onSelectOrder, value: currentSortDirection, children: [jsx(RadioItem, { className: "w-full", label: t("table.sorting.ascending"), value: "asc" }), jsx(RadioItem, { className: "w-full", label: t("table.sorting.descending"), value: "desc" })] })] }) }) })] }) }));
889
889
  };
890
890
 
891
891
  /**
@@ -933,9 +933,9 @@ const Sorting = ({ columns, }) => {
933
933
  * />
934
934
  * ```
935
935
  */
936
- const SelectAllBanner = ({ areAllSelected, selectedCount, onClickSelectAll, onClickClearSelection, selectAllLabel, style, }) => {
936
+ const SelectAllBanner = ({ areAllSelected, selectedCount, onClickSelectAll, onClickClearSelection, selectAllLabel, className, "data-testid": dataTestId = "select-all-banner", style, ref, }) => {
937
937
  const [t] = useTranslation();
938
- return (jsx("div", { className: "flex w-full items-center justify-center gap-1 border-y border-neutral-200 bg-neutral-100 px-4 py-2 text-xs", "data-testid": "select-all-banner", style: style, children: areAllSelected ? (jsxs(Fragment, { children: [jsx("span", { className: "text-neutral-600", children: jsx(Trans, { components: { strong: jsx("span", { className: "font-medium" }) }, i18nKey: "table.selectAll.allSelected", values: { totalCount: selectedCount } }) }), jsx(Button, { onClick: onClickClearSelection, size: "small", variant: "ghost", children: t("table.selectAll.clearSelection") })] })) : (jsxs(Fragment, { children: [jsx("span", { className: "text-neutral-600", children: jsx(Trans, { components: { strong: jsx("span", { className: "font-medium" }) }, i18nKey: "table.selectAll.pageSelected", values: { count: selectedCount } }) }), jsx(Button, { onClick: onClickSelectAll, size: "small", variant: "ghost", children: selectAllLabel ?? t("table.selectAll.selectAll") })] })) }));
938
+ return (jsx("div", { className: cx("flex w-full items-center justify-center gap-1 border-y border-neutral-200 bg-neutral-100 px-4 py-2 text-xs", className), "data-testid": dataTestId, ref: ref, style: style, children: areAllSelected ? (jsxs(Fragment, { children: [jsx("span", { className: "text-neutral-600", children: jsx(Trans, { components: { strong: jsx("span", { className: "font-medium" }) }, i18nKey: "table.selectAll.allSelected", values: { totalCount: selectedCount } }) }), jsx(Button, { onClick: onClickClearSelection, size: "small", variant: "ghost", children: t("table.selectAll.clearSelection") })] })) : (jsxs(Fragment, { children: [jsx("span", { className: "text-neutral-600", children: jsx(Trans, { components: { strong: jsx("span", { className: "font-medium" }) }, i18nKey: "table.selectAll.pageSelected", values: { count: selectedCount } }) }), jsx(Button, { onClick: onClickSelectAll, size: "small", variant: "ghost", children: selectAllLabel ?? t("table.selectAll.selectAll") })] })) }));
939
939
  };
940
940
 
941
941
  /**
@@ -1500,7 +1500,7 @@ const Table = ({ rowHeight = 50, loading = false, hideFooter = false, style, ref
1500
1500
  header.column.getToggleSortingHandler()?.(event);
1501
1501
  }
1502
1502
  }, [props]);
1503
- return (jsxs(Card, { className: twMerge("table-compact flex flex-col overflow-hidden", props.className), "data-testid": props["data-testid"], ref: ref, style: style, children: [nonNullable(props.headerLeftActions) || nonNullable(props.headerRightActions) ? (jsxs("div", { className: "flex-wrap-reverse-readable items-center gap-2 p-2", children: [nonNullable(props.headerLeftActions) ? (jsx(HorizontalOverflowScroller, { className: "w-auto min-w-0", children: jsx("div", { className: "flex items-center gap-2", children: props.headerLeftActions }) })) : null, nonNullable(props.headerRightActions) ? (jsx(HorizontalOverflowScroller, { className: "ml-auto w-auto min-w-0", children: jsx("div", { className: "flex items-center gap-2", children: props.headerRightActions }) })) : null] })) : null, props.subHeaderActions, jsx("div", { className: twMerge("h-full overflow-x-auto overflow-y-scroll border-b border-neutral-200", (nonNullable(props.headerLeftActions) || nonNullable(props.headerRightActions)) &&
1503
+ return (jsxs(Card, { className: twMerge("table-compact flex flex-col overflow-hidden", props.className), "data-testid": props["data-testid"], ref: ref, style: style, children: [nonNullable(props.headerLeftActions) || nonNullable(props.headerRightActions) ? (jsxs("div", { className: "flex-wrap-reverse-readable items-center gap-2 p-2", children: [nonNullable(props.headerLeftActions) ? (jsx(HorizontalOverflowScroller, { className: "w-auto min-w-0", children: jsx("div", { className: "flex items-center gap-2", children: props.headerLeftActions }) })) : null, nonNullable(props.headerRightActions) ? (jsx(HorizontalOverflowScroller, { className: "ml-auto w-auto min-w-0", children: jsx("div", { className: "flex items-center gap-2", children: props.headerRightActions }) })) : null] })) : null, props.subHeaderActions, jsx("div", { className: twMerge("z-default h-full overflow-x-auto overflow-y-scroll border-b border-neutral-200", (nonNullable(props.headerLeftActions) || nonNullable(props.headerRightActions)) &&
1504
1504
  !nonNullable(props.subHeaderActions)
1505
1505
  ? "border-t"
1506
1506
  : ""), ref: tableScrollElementRef, children: jsxs(TableRoot, { style: {
@@ -1597,15 +1597,13 @@ const Table = ({ rowHeight = 50, loading = false, hideFooter = false, style, ref
1597
1597
  }
1598
1598
  }) })) : (jsx("tbody", { className: cvaTBody({
1599
1599
  emptyState: !loading && (props.noDataMessage === undefined || props.noDataMessage === ""),
1600
- }), children: jsx("tr", { children: jsx("td", { className: "b-0", children: loading ? (jsx(Spinner, { centering: "centered", containerClassName: "absolute inset-0", "data-testid": "table-loading-spinner" })) : props.noDataMessage !== undefined && props.noDataMessage !== "" ? (props.noDataMessage) : (jsx(EmptyState, { className: "absolute inset-0", description: t("table.noResults"), image: "SEARCH_DOCUMENT", ...props.emptyState })) }) }) }))] }) }), hideFooter ? null : (jsxs("div", { className: "flex flex-wrap items-center gap-2 p-2", "data-testid": "table-footer", children: [jsx("div", { className: "whitespace-nowrap text-xs font-medium text-neutral-600", children: loading && !hasResults ? (jsx(SkeletonLabel, { "data-testid": "table-footer-count-loading", flexibleWidth: false, textSize: "text-xs", width: "9rem" })) : typeof props.pagination?.pageInfo?.count === "number"
1601
- ? t(props.pagination.pageInfo.isCountCapped ? "table.pagination.full.capped" : "table.pagination.full", {
1602
- count: props.getRowModel().rows.length,
1603
- total: props.pagination.pageInfo.count,
1604
- })
1605
- : t(props.pagination?.pageInfo?.hasNextPage ? "table.pagination.full.capped" : "table.pagination.full", {
1606
- count: props.getRowModel().rows.length,
1607
- total: props.getRowModel().rows.length,
1608
- }) }), props.pagination?.isLoading && hasResults ? (jsx("span", { children: jsx(Spinner, { size: "small" }) })) : null, nonNullable(props.footerRightActions) ? (jsx(HorizontalOverflowScroller, { className: "ml-auto w-auto min-w-0", children: jsx("div", { className: "flex items-center gap-2", children: props.footerRightActions }) })) : null] }))] }));
1600
+ }), children: jsx("tr", { children: jsx("td", { className: "b-0", children: loading ? (jsx(Spinner, { centering: "centered", containerClassName: "absolute inset-0", "data-testid": "table-loading-spinner" })) : props.noDataMessage !== undefined && props.noDataMessage !== "" ? (props.noDataMessage) : (jsx(EmptyState, { className: "absolute inset-0", description: t("table.noResults"), image: "SEARCH_DOCUMENT", ...props.emptyState })) }) }) }))] }) }), hideFooter ? null : (jsxs("div", { className: "flex flex-wrap items-center gap-2 p-2", "data-testid": "table-footer", children: [jsx("div", { className: "whitespace-nowrap text-xs font-medium text-neutral-600", children: loading && !hasResults ? (jsx(SkeletonLabel, { "data-testid": "table-footer-count-loading", flexibleWidth: false, textSize: "text-xs", width: "9rem" })) : typeof props.pagination?.pageInfo?.count === "number" ? (t(props.pagination.pageInfo.isCountCapped ? "table.pagination.full.capped" : "table.pagination.full", {
1601
+ count: props.getRowModel().rows.length,
1602
+ total: props.pagination.pageInfo.count,
1603
+ })) : (t(props.pagination?.pageInfo?.hasNextPage ? "table.pagination.full.capped" : "table.pagination.full", {
1604
+ count: props.getRowModel().rows.length,
1605
+ total: props.getRowModel().rows.length,
1606
+ })) }), props.pagination?.isLoading && hasResults ? (jsx("span", { children: jsx(Spinner, { size: "small" }) })) : null, nonNullable(props.footerRightActions) ? (jsx(HorizontalOverflowScroller, { className: "ml-auto w-auto min-w-0", children: jsx("div", { className: "flex items-center gap-2", children: props.footerRightActions }) })) : null] }))] }));
1609
1607
  };
1610
1608
  const cvaTBody = cva({
1611
1609
  base: ["min-h-[40dvh]"],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-table",
3
- "version": "2.11.17",
3
+ "version": "2.12.0",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -11,15 +11,15 @@
11
11
  "react-dnd": "16.0.1",
12
12
  "react-dnd-html5-backend": "16.0.1",
13
13
  "tailwind-merge": "^2.0.0",
14
- "@trackunit/react-components": "3.8.10",
15
- "@trackunit/react-core-hooks": "1.25.11",
16
- "@trackunit/shared-utils": "1.19.10",
17
- "@trackunit/css-class-variance-utilities": "2.3.10",
18
- "@trackunit/ui-icons": "1.17.9",
19
- "@trackunit/react-table-base-components": "2.12.17",
20
- "@trackunit/react-form-components": "2.10.17",
21
- "@trackunit/i18n-library-translation": "2.8.11",
22
- "@trackunit/iris-app-runtime-core-api": "1.21.10",
14
+ "@trackunit/react-components": "3.9.0",
15
+ "@trackunit/react-core-hooks": "1.26.0",
16
+ "@trackunit/shared-utils": "1.20.0",
17
+ "@trackunit/css-class-variance-utilities": "2.4.0",
18
+ "@trackunit/ui-icons": "1.18.0",
19
+ "@trackunit/react-table-base-components": "2.13.0",
20
+ "@trackunit/react-form-components": "2.11.0",
21
+ "@trackunit/i18n-library-translation": "2.9.0",
22
+ "@trackunit/iris-app-runtime-core-api": "1.22.0",
23
23
  "zod": "^3.25.76"
24
24
  },
25
25
  "peerDependencies": {
@@ -1,6 +1,6 @@
1
- import { CommonProps, type Styleable } from "@trackunit/react-components";
1
+ import { CommonProps, Refable, type Styleable } from "@trackunit/react-components";
2
2
  import { ActionModel, DropdownModel } from "./Actions";
3
- export interface ActionSheetProps extends CommonProps, Styleable {
3
+ export interface ActionSheetProps extends CommonProps, Styleable, Refable<HTMLDivElement> {
4
4
  /**
5
5
  * Actions to be displayed in the ActionSheet as primary actions (normally visible)
6
6
  */
@@ -127,4 +127,4 @@ export interface ActionSheetProps extends CommonProps, Styleable {
127
127
  * @param {ActionSheetProps} props - The props for the ActionSheet component
128
128
  * @returns {ReactElement} ActionSheet component
129
129
  */
130
- export declare const ActionSheet: ({ actions, dropdownActions, moreActions, selections, resetSelection, className, style, "data-testid": dataTestId, }: ActionSheetProps) => import("react").JSX.Element;
130
+ export declare const ActionSheet: ({ actions, dropdownActions, moreActions, selections, resetSelection, className, style, "data-testid": dataTestId, ref, }: ActionSheetProps) => import("react").JSX.Element;
@@ -1,6 +1,6 @@
1
- import { type Styleable } from "@trackunit/react-components";
1
+ import { CommonProps, Refable, type Styleable } from "@trackunit/react-components";
2
2
  import type { MouseEventHandler, ReactElement } from "react";
3
- export interface SelectAllBannerProps extends Styleable {
3
+ export interface SelectAllBannerProps extends CommonProps, Styleable, Refable<HTMLDivElement> {
4
4
  /** Whether all items across all pages are currently selected */
5
5
  readonly areAllSelected: boolean;
6
6
  /** Number of items currently selected (on this page or total) */
@@ -57,4 +57,4 @@ export interface SelectAllBannerProps extends Styleable {
57
57
  * />
58
58
  * ```
59
59
  */
60
- export declare const SelectAllBanner: ({ areAllSelected, selectedCount, onClickSelectAll, onClickClearSelection, selectAllLabel, style, }: SelectAllBannerProps) => ReactElement;
60
+ export declare const SelectAllBanner: ({ areAllSelected, selectedCount, onClickSelectAll, onClickClearSelection, selectAllLabel, className, "data-testid": dataTestId, style, ref, }: SelectAllBannerProps) => ReactElement;
@@ -1,7 +1,8 @@
1
1
  import { Column } from "@tanstack/react-table";
2
+ import { CommonProps, Refable, type Styleable } from "@trackunit/react-components";
2
3
  import { ReactElement } from "react";
3
4
  type SortableColumn<TSorting extends object, TSortingValue> = Pick<Column<TSorting, TSortingValue>, "id" | "getCanSort" | "getIsSorted" | "toggleSorting" | "columnDef">;
4
- interface SortingProps<TSorting extends object, TSortingValue> {
5
+ interface SortingProps<TSorting extends object, TSortingValue> extends CommonProps, Styleable, Refable<HTMLButtonElement> {
5
6
  columns: Array<SortableColumn<TSorting, TSortingValue>>;
6
7
  }
7
8
  /**
@@ -12,5 +13,5 @@ interface SortingProps<TSorting extends object, TSortingValue> {
12
13
  * @param {SortingProps<TSorting, TSortingValue>} props - The props object containing sorting properties.
13
14
  * @returns {ReactElement | null} A React JSX element representing the Sorting component or null if there are no sortable columns.
14
15
  */
15
- export declare const Sorting: <TSorting extends object, TSortingValue>({ columns, }: SortingProps<TSorting, TSortingValue>) => ReactElement | null;
16
+ export declare const Sorting: <TSorting extends object, TSortingValue>({ columns, className, "data-testid": dataTestId, style, ref, }: SortingProps<TSorting, TSortingValue>) => ReactElement | null;
16
17
  export {};