@trackunit/react-table 1.24.1 → 1.24.2

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
@@ -364,9 +364,9 @@ const ActionContainerAndOverflow = ({ actions, dropdownActions, moreActions, "da
364
364
  * @param {ActionSheetProps} props - The props for the ActionSheet component
365
365
  * @returns {ReactElement} ActionSheet component
366
366
  */
367
- const ActionSheet = ({ actions, dropdownActions, moreActions = [], selections, resetSelection, className, "data-testid": dataTestId, }) => {
367
+ const ActionSheet = ({ actions, dropdownActions, moreActions = [], selections, resetSelection, className, style, "data-testid": dataTestId, }) => {
368
368
  const [t] = useTranslation();
369
- return (jsxRuntime.jsxs("div", { className: cvaActionSheet({ className }), "data-testid": dataTestId, children: [jsxRuntime.jsx(reactComponents.Button, { className: "row-start-1", "data-testid": "XButton",
369
+ return (jsxRuntime.jsxs("div", { className: cvaActionSheet({ className }), "data-testid": dataTestId, style: style, children: [jsxRuntime.jsx(reactComponents.Button, { className: "row-start-1", "data-testid": "XButton",
370
370
  // eslint-disable-next-line @trackunit/prefer-event-specific-callback-naming
371
371
  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,
372
372
  actions,
@@ -638,9 +638,9 @@ const Sorting = ({ columns, }) => {
638
638
  * />
639
639
  * ```
640
640
  */
641
- const SelectAllBanner = ({ areAllSelected, selectedCount, onClickSelectAll, onClickClearSelection, selectAllLabel, }) => {
641
+ const SelectAllBanner = ({ areAllSelected, selectedCount, onClickSelectAll, onClickClearSelection, selectAllLabel, style, }) => {
642
642
  const [t] = useTranslation();
643
- 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", 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") })] })) }));
643
+ 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") })] })) }));
644
644
  };
645
645
 
646
646
  /**
@@ -1122,7 +1122,7 @@ const ColumnSorting = ({ canSort, sortingState = false }) => {
1122
1122
  *
1123
1123
  * ```
1124
1124
  */
1125
- const Table = ({ rowHeight = 50, loading = false, hideFooter = false, ...props }) => {
1125
+ const Table = ({ rowHeight = 50, loading = false, hideFooter = false, style, ...props }) => {
1126
1126
  //we need a reference to the scrolling element for logic down below
1127
1127
  const tableScrollElementRef = react.useRef(null);
1128
1128
  const [t] = useTranslation();
@@ -1199,7 +1199,7 @@ const Table = ({ rowHeight = 50, loading = false, hideFooter = false, ...props }
1199
1199
  header.column.getToggleSortingHandler()?.(event);
1200
1200
  }
1201
1201
  }, [props]);
1202
- return (jsxRuntime.jsxs(reactComponents.Card, { className: tailwindMerge.twMerge("table-compact flex flex-col overflow-hidden", props.className), "data-testid": props["data-testid"], children: [(props.headerLeftActions !== undefined && props.headerLeftActions !== null) ||
1202
+ return (jsxRuntime.jsxs(reactComponents.Card, { className: tailwindMerge.twMerge("table-compact flex flex-col overflow-hidden", props.className), "data-testid": props["data-testid"], style: style, children: [(props.headerLeftActions !== undefined && props.headerLeftActions !== null) ||
1203
1203
  (props.headerRightActions !== undefined && props.headerRightActions !== null) ? (jsxRuntime.jsxs("div", { className: "z-default flex justify-between gap-2 p-2", children: [jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.headerLeftActions }), jsxRuntime.jsx("div", { className: "flex items-center gap-2", children: props.headerRightActions })] })) : null, props.subHeaderActions, jsxRuntime.jsx("div", { className: tailwindMerge.twMerge("h-full overflow-x-auto overflow-y-scroll border-b border-neutral-200", (props.subHeaderActions === undefined || props.subHeaderActions === null) &&
1204
1204
  ((props.headerLeftActions !== undefined && props.headerLeftActions !== null) ||
1205
1205
  (props.headerRightActions !== undefined && props.headerRightActions !== null))
package/index.esm.js CHANGED
@@ -363,9 +363,9 @@ const ActionContainerAndOverflow = ({ actions, dropdownActions, moreActions, "da
363
363
  * @param {ActionSheetProps} props - The props for the ActionSheet component
364
364
  * @returns {ReactElement} ActionSheet component
365
365
  */
366
- const ActionSheet = ({ actions, dropdownActions, moreActions = [], selections, resetSelection, className, "data-testid": dataTestId, }) => {
366
+ const ActionSheet = ({ actions, dropdownActions, moreActions = [], selections, resetSelection, className, style, "data-testid": dataTestId, }) => {
367
367
  const [t] = useTranslation();
368
- return (jsxs("div", { className: cvaActionSheet({ className }), "data-testid": dataTestId, children: [jsx(Button, { className: "row-start-1", "data-testid": "XButton",
368
+ return (jsxs("div", { className: cvaActionSheet({ className }), "data-testid": dataTestId, style: style, children: [jsx(Button, { className: "row-start-1", "data-testid": "XButton",
369
369
  // eslint-disable-next-line @trackunit/prefer-event-specific-callback-naming
370
370
  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,
371
371
  actions,
@@ -637,9 +637,9 @@ const Sorting = ({ columns, }) => {
637
637
  * />
638
638
  * ```
639
639
  */
640
- const SelectAllBanner = ({ areAllSelected, selectedCount, onClickSelectAll, onClickClearSelection, selectAllLabel, }) => {
640
+ const SelectAllBanner = ({ areAllSelected, selectedCount, onClickSelectAll, onClickClearSelection, selectAllLabel, style, }) => {
641
641
  const [t] = useTranslation();
642
- 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", 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") })] })) }));
642
+ 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") })] })) }));
643
643
  };
644
644
 
645
645
  /**
@@ -1121,7 +1121,7 @@ const ColumnSorting = ({ canSort, sortingState = false }) => {
1121
1121
  *
1122
1122
  * ```
1123
1123
  */
1124
- const Table = ({ rowHeight = 50, loading = false, hideFooter = false, ...props }) => {
1124
+ const Table = ({ rowHeight = 50, loading = false, hideFooter = false, style, ...props }) => {
1125
1125
  //we need a reference to the scrolling element for logic down below
1126
1126
  const tableScrollElementRef = useRef(null);
1127
1127
  const [t] = useTranslation();
@@ -1198,7 +1198,7 @@ const Table = ({ rowHeight = 50, loading = false, hideFooter = false, ...props }
1198
1198
  header.column.getToggleSortingHandler()?.(event);
1199
1199
  }
1200
1200
  }, [props]);
1201
- return (jsxs(Card, { className: twMerge("table-compact flex flex-col overflow-hidden", props.className), "data-testid": props["data-testid"], children: [(props.headerLeftActions !== undefined && props.headerLeftActions !== null) ||
1201
+ return (jsxs(Card, { className: twMerge("table-compact flex flex-col overflow-hidden", props.className), "data-testid": props["data-testid"], style: style, children: [(props.headerLeftActions !== undefined && props.headerLeftActions !== null) ||
1202
1202
  (props.headerRightActions !== undefined && props.headerRightActions !== null) ? (jsxs("div", { className: "z-default flex justify-between gap-2 p-2", children: [jsx("div", { className: "flex items-center gap-2", children: props.headerLeftActions }), jsx("div", { className: "flex items-center gap-2", children: props.headerRightActions })] })) : null, props.subHeaderActions, jsx("div", { className: twMerge("h-full overflow-x-auto overflow-y-scroll border-b border-neutral-200", (props.subHeaderActions === undefined || props.subHeaderActions === null) &&
1203
1203
  ((props.headerLeftActions !== undefined && props.headerLeftActions !== null) ||
1204
1204
  (props.headerRightActions !== undefined && props.headerRightActions !== null))
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@trackunit/react-table",
3
- "version": "1.24.1",
3
+ "version": "1.24.2",
4
4
  "repository": "https://github.com/Trackunit/manager",
5
5
  "license": "SEE LICENSE IN LICENSE.txt",
6
6
  "engines": {
@@ -15,8 +15,8 @@
15
15
  "@trackunit/shared-utils": "1.15.1",
16
16
  "@trackunit/css-class-variance-utilities": "1.13.1",
17
17
  "@trackunit/ui-icons": "1.13.1",
18
- "@trackunit/react-table-base-components": "1.24.1",
19
- "@trackunit/react-form-components": "1.25.1",
18
+ "@trackunit/react-table-base-components": "1.24.2",
19
+ "@trackunit/react-form-components": "1.25.2",
20
20
  "@trackunit/i18n-library-translation": "1.21.1",
21
21
  "@trackunit/iris-app-runtime-core-api": "1.16.1"
22
22
  },
@@ -1,6 +1,6 @@
1
- import { CommonProps } from "@trackunit/react-components";
1
+ import { CommonProps, type Styleable } from "@trackunit/react-components";
2
2
  import { ActionModel, DropdownModel } from "./Actions";
3
- export interface ActionSheetProps extends CommonProps {
3
+ export interface ActionSheetProps extends CommonProps, Styleable {
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 {
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, "data-testid": dataTestId, }: ActionSheetProps) => import("react/jsx-runtime").JSX.Element;
130
+ export declare const ActionSheet: ({ actions, dropdownActions, moreActions, selections, resetSelection, className, style, "data-testid": dataTestId, }: ActionSheetProps) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,6 @@
1
+ import { type Styleable } from "@trackunit/react-components";
1
2
  import type { MouseEventHandler, ReactElement } from "react";
2
- export interface SelectAllBannerProps {
3
+ export interface SelectAllBannerProps extends Styleable {
3
4
  /** Whether all items across all pages are currently selected */
4
5
  readonly areAllSelected: boolean;
5
6
  /** Number of items currently selected (on this page or total) */
@@ -56,4 +57,4 @@ export interface SelectAllBannerProps {
56
57
  * />
57
58
  * ```
58
59
  */
59
- export declare const SelectAllBanner: ({ areAllSelected, selectedCount, onClickSelectAll, onClickClearSelection, selectAllLabel, }: SelectAllBannerProps) => ReactElement;
60
+ export declare const SelectAllBanner: ({ areAllSelected, selectedCount, onClickSelectAll, onClickClearSelection, selectAllLabel, style, }: SelectAllBannerProps) => ReactElement;
package/src/Table.d.ts CHANGED
@@ -1,8 +1,8 @@
1
1
  import { Table as ReactTable, Row } from "@tanstack/react-table";
2
- import { CommonProps, EmptyStateProps, RelayPagination } from "@trackunit/react-components";
2
+ import { CommonProps, EmptyStateProps, RelayPagination, type Styleable } from "@trackunit/react-components";
3
3
  import { ReactElement, ReactNode } from "react";
4
4
  import "./table-animations.css";
5
- export interface TableProps<TData extends object> extends ReactTable<TData>, CommonProps {
5
+ export interface TableProps<TData extends object> extends ReactTable<TData>, CommonProps, Styleable {
6
6
  /**
7
7
  * Relay-style pagination object for infinite scroll. Use with `usePaginationQuery` hook
8
8
  * to automatically handle fetching more data as the user scrolls.
@@ -177,4 +177,4 @@ export interface TableProps<TData extends object> extends ReactTable<TData>, Com
177
177
  *
178
178
  * ```
179
179
  */
180
- export declare const Table: <TData extends object>({ rowHeight, loading, hideFooter, ...props }: TableProps<TData>) => ReactElement;
180
+ export declare const Table: <TData extends object>({ rowHeight, loading, hideFooter, style, ...props }: TableProps<TData>) => ReactElement;