@agilant/toga-blox 1.0.199 → 1.0.201

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.
@@ -1,16 +1,3 @@
1
- import { DataWithUUID } from "./types";
2
- export interface TableCellProps<T extends DataWithUUID> {
3
- cell: any;
4
- isLastCell: boolean;
5
- hasInfiniteScroll: boolean;
6
- rowUuid?: string;
7
- expanded: boolean;
8
- onToggle: () => void;
9
- linkText?: string;
10
- cellExpandable?: boolean;
11
- maxCharacters?: number;
12
- cellMaxWidthWhenExpanded?: number;
13
- cellColor: string;
14
- }
15
- declare const TableCell: <T extends DataWithUUID>({ cell, isLastCell, hasInfiniteScroll, expanded, onToggle, linkText, cellExpandable, maxCharacters, cellMaxWidthWhenExpanded, cellColor, }: TableCellProps<T>) => import("react/jsx-runtime").JSX.Element;
1
+ import { TableCellProps } from "./types";
2
+ declare const TableCell: ({ cell, isLastCell, hasInfiniteScroll, expanded, onToggle, maxCharacters, cellMaxWidthWhenExpanded, cellColor, additionalCellClassNames, toggleComponent: ToggleComponent, cellExpandable, linkTextClassNames, }: TableCellProps) => import("react/jsx-runtime").JSX.Element;
16
3
  export default TableCell;
@@ -1,28 +1,26 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
- const MAX_CHARS = 30;
3
- const TableCell = ({ cell, isLastCell, hasInfiniteScroll, expanded, onToggle, linkText = "text-purple-500 ml-1 underline", cellExpandable = false, maxCharacters, cellMaxWidthWhenExpanded = 50, cellColor = "bg-blue-500", }) => {
4
- /* decide if this cell even needs a toggle */
2
+ const DEFAULT_MAX_CHARS = 30;
3
+ // Default only implements the **collapsed** “Show more” UI.
4
+ // We’ll never use its expanded branch, since expanded is handled below.
5
+ const DefaultCollapsedToggle = ({ onToggle, truncated, className = "", linkTextClassNames = "text-purple-500 ml-1 underline", }) => (_jsx("div", { className: `flex items-center group ${className}`, onClick: (e) => {
6
+ e.stopPropagation();
7
+ onToggle();
8
+ }, children: _jsxs("span", { children: [truncated, "\u2026", _jsx("span", { className: "hidden group-hover:inline text-purple-500 ml-1 underline", children: "Show more" })] }) }));
9
+ const TableCell = ({ cell, isLastCell, hasInfiniteScroll, expanded, onToggle, maxCharacters = DEFAULT_MAX_CHARS, cellMaxWidthWhenExpanded = 50, cellColor = "bg-blue-500", additionalCellClassNames = "", toggleComponent: ToggleComponent = DefaultCollapsedToggle, cellExpandable = false, linkTextClassNames = "text-purple-500 ml-1 underline", }) => {
10
+ // --- truncation logic ---
5
11
  const isString = typeof cell.value === "string";
6
12
  const fullText = isString ? cell.value : "";
7
13
  const isLong = isString && fullText.length > maxCharacters;
8
- const hasToggle = cellExpandable && isLong;
9
14
  const truncated = fullText.slice(0, maxCharacters);
10
- /* stop row click when toggling */
11
- const handleToggle = (e) => {
12
- e.stopPropagation(); // ← prevents bubbling to the <tr>
13
- onToggle();
14
- };
15
+ const needsToggle = cellExpandable && isLong;
16
+ // --- sticky support ---
15
17
  const isStickyColumn = cell?.column?.sticky === "left";
16
- const stickyLeft = isStickyColumn && cell.column?.style
17
- ? cell.column.style.left ?? 0
18
- : 0;
19
- const stickyClass = isStickyColumn ? cell.column?.className || "" : "";
20
- const baseTd = `relative overflow-hidden font-light text-sm text-left px-5 ${cellColor}`;
21
- const wrapper = ` min-h-[40px] flex select-none ${cellColor} ${hasToggle ? " cursor-pointer" : ""}`;
22
- // FIX: extract key before spreading props into <td>
18
+ const baseTd = `relative overflow-hidden font-light text-sm text-left px-5 ${cellColor}`;
19
+ const wrapper = `min-h-[40px] flex select-none ${cellColor} ${needsToggle ? "cursor-pointer" : ""}`;
20
+ // extract key before spreading
23
21
  const rawCellProps = cell.getCellProps({
24
22
  className: isLastCell ? "" : baseTd,
25
- style: cell.column?.sticky === "left"
23
+ style: isStickyColumn
26
24
  ? {
27
25
  position: "sticky",
28
26
  left: cell.column.style?.left || 0,
@@ -30,19 +28,18 @@ const TableCell = ({ cell, isLastCell, hasInfiniteScroll, expanded, onToggle, li
30
28
  }
31
29
  : {},
32
30
  });
33
- const { key: cellKey, ...safeCellProps } = Object.assign({}, rawCellProps);
34
- return (_jsx("td", { ...safeCellProps, className: isStickyColumn ? undefined : isLastCell ? "" : baseTd, children: _jsx("div", { className: wrapper, children: hasToggle ? (!expanded ? (
35
- /* collapsed view */
36
- _jsx("div", { className: "flex items-start group", children: _jsxs("span", { children: [truncated, "\u2026", _jsx("span", { ...(hasToggle
37
- ? { onClick: handleToggle }
38
- : {}), className: `hidden group-hover:inline ${linkText}`, children: "Show more" })] }) })) : (
39
- /* expanded view */
40
- _jsxs("div", { className: `flex flex-col `, style: {
31
+ const { key: cellKey, ...safeCellProps } = rawCellProps;
32
+ return (_jsx("td", { ...safeCellProps, className: isStickyColumn ? undefined : isLastCell ? "" : baseTd, children: _jsx("div", { className: wrapper, style: { maxWidth: `${cellMaxWidthWhenExpanded}ch` }, children: needsToggle ? (!expanded ? (
33
+ // **collapsed**: use your ToggleComponent (portal-friendly)
34
+ _jsx(ToggleComponent, { expanded: expanded, onToggle: onToggle, truncated: truncated, fullText: fullText, className: additionalCellClassNames, linkTextClassNames: linkTextClassNames })) : (
35
+ // **expanded**: always use this constant layout
36
+ _jsxs("div", { className: "flex flex-col", style: {
41
37
  maxWidth: `${cellMaxWidthWhenExpanded}ch`,
42
- }, children: [_jsx("span", { children: fullText }), _jsx("span", { ...(hasToggle
43
- ? { onClick: handleToggle }
44
- : {}), className: linkText, children: "Show less" })] }))) : (
45
- /* no toggle required */
38
+ }, children: [_jsx("span", { className: "text-left pr-5", children: fullText }), _jsx("span", { onClick: (e) => {
39
+ e.stopPropagation();
40
+ onToggle();
41
+ }, className: linkTextClassNames, children: "Show less" })] }))) : (
42
+ // no truncation needed
46
43
  cell.render("Cell")) }) }, cellKey));
47
44
  };
48
45
  export default TableCell;
@@ -6,3 +6,4 @@ export declare const Default: any;
6
6
  export declare const CollapsedByDefault: any;
7
7
  export declare const NoExpand: any;
8
8
  export declare const LastCell: any;
9
+ export declare const WithCustomToggle: any;
@@ -1,9 +1,13 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
1
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
2
2
  // src/components/TableCell/TableCell.stories.tsx
3
3
  import { useState } from "react";
4
4
  import TableCell from ".";
5
+ // ----- Custom Toggle component -----
6
+ const CustomToggle = ({ expanded, onToggle, truncated, fullText, className = "", linkTextClassNames = "text-purple-500 ml-1 underline", }) => (_jsx("button", { onClick: (e) => {
7
+ e.stopPropagation();
8
+ onToggle();
9
+ }, className: `px-2 py-1 border rounded ${className}`, children: expanded ? (_jsxs(_Fragment, { children: [fullText, " ", _jsx("span", { className: linkTextClassNames, children: "\u25B2 Less" })] })) : (_jsxs(_Fragment, { children: [truncated, "\u2026 ", _jsx("span", { className: linkTextClassNames, children: "\u25BC More" })] })) }));
5
10
  const sampleData = {
6
- uuid: "12345",
7
11
  address: "123 Main St, Springfield, IL, 62701, United States of America — this is a very long address so we can show the expand behavior.",
8
12
  };
9
13
  /* ---------- story config ---------- */
@@ -37,7 +41,7 @@ const Template = (args) => {
37
41
  getCellProps: () => ({}),
38
42
  column: {},
39
43
  };
40
- return (_jsx("table", { children: _jsx("tbody", { children: _jsx("tr", { children: _jsx(TableCell, { cellColor: "", ...args, cell: fakeCell, expanded: expanded, onToggle: () => setExpanded((e) => !e) }) }) }) }));
44
+ return (_jsx("table", { children: _jsx("tbody", { children: _jsx("tr", { children: _jsx(TableCell, { additionalCellClassNames: "", cellColor: "", ...args, cell: fakeCell, expanded: expanded, onToggle: () => setExpanded((e) => !e) }) }) }) }));
41
45
  };
42
46
  /* ---------- stories ---------- */
43
47
  export const Default = Template.bind({});
@@ -62,3 +66,11 @@ LastCell.args = {
62
66
  isLastCell: true,
63
67
  cellExpandable: true,
64
68
  };
69
+ export const WithCustomToggle = Template.bind({});
70
+ WithCustomToggle.args = {
71
+ isLastCell: false,
72
+ cellExpandable: true,
73
+ maxCharacters: 20,
74
+ toggleComponent: CustomToggle,
75
+ hasInfiniteScroll: true,
76
+ };
@@ -9,6 +9,7 @@ const sampleData = {
9
9
  age: 30,
10
10
  address: "123 Main St, Springfield, IL, 62701, United States of America",
11
11
  };
12
+ //FIXME: THIS SHOULD NOT BE ANY
12
13
  const defaultProps = {
13
14
  globalTrimActive: true,
14
15
  rowUuid: sampleData.uuid,
@@ -55,7 +56,7 @@ const defaultProps = {
55
56
  };
56
57
  describe("TableCell Component", () => {
57
58
  it("trims the text when globalTrimActive is true", () => {
58
- render(_jsx("table", { children: _jsx("tbody", { children: _jsx("tr", { children: _jsx(TableCell, { cellColor: "", expanded: false, onToggle: function () {
59
+ render(_jsx("table", { children: _jsx("tbody", { children: _jsx("tr", { children: _jsx(TableCell, { additionalCellClassNames: "", cellColor: "", expanded: false, onToggle: function () {
59
60
  throw new Error("Function not implemented.");
60
61
  }, ...defaultProps }) }) }) }));
61
62
  const trimmedText = `${sampleData.address.substring(0, 30)}...`;
@@ -63,14 +64,14 @@ describe("TableCell Component", () => {
63
64
  });
64
65
  it("does not trim the text when globalTrimActive is false", () => {
65
66
  const props = { ...defaultProps, globalTrimActive: false };
66
- render(_jsx("table", { children: _jsx("tbody", { children: _jsx("tr", { children: _jsx(TableCell, { cellColor: "", expanded: false, onToggle: function () {
67
+ render(_jsx("table", { children: _jsx("tbody", { children: _jsx("tr", { children: _jsx(TableCell, { additionalCellClassNames: "", cellColor: "", expanded: false, onToggle: function () {
67
68
  throw new Error("Function not implemented.");
68
69
  }, ...props }) }) }) }));
69
70
  expect(screen.getByText(sampleData.address)).toBeInTheDocument();
70
71
  });
71
72
  it("applies different styles when isLastCell is true", () => {
72
73
  const props = { ...defaultProps, isLastCell: true };
73
- render(_jsx("table", { children: _jsx("tbody", { children: _jsx("tr", { children: _jsx(TableCell, { cellColor: "", expanded: false, onToggle: function () {
74
+ render(_jsx("table", { children: _jsx("tbody", { children: _jsx("tr", { children: _jsx(TableCell, { additionalCellClassNames: "", cellColor: "", expanded: false, onToggle: function () {
74
75
  throw new Error("Function not implemented.");
75
76
  }, ...props }) }) }) }));
76
77
  const cell = screen.getByRole("cell");
@@ -85,7 +86,7 @@ describe("TableCell Component", () => {
85
86
  render: (type) => (type === "Cell" ? "42" : null),
86
87
  },
87
88
  };
88
- render(_jsx("table", { children: _jsx("tbody", { children: _jsx("tr", { children: _jsx(TableCell, { cellColor: "", expanded: false, onToggle: function () {
89
+ render(_jsx("table", { children: _jsx("tbody", { children: _jsx("tr", { children: _jsx(TableCell, { additionalCellClassNames: "", cellColor: "", expanded: false, onToggle: function () {
89
90
  throw new Error("Function not implemented.");
90
91
  }, ...numericValueProps }) }) }) }));
91
92
  expect(screen.getByText("42")).toBeInTheDocument();
@@ -1,14 +1,37 @@
1
- import { Cell } from "react-table";
2
1
  export interface DataWithUUID {
3
2
  uuid?: string;
4
3
  }
5
- export interface TableCellProps<T extends object> {
6
- cell: Cell<T>;
4
+ export interface ToggleProps {
5
+ expanded: boolean;
6
+ onToggle: () => void;
7
+ truncated: string;
8
+ fullText: string;
9
+ className?: string;
10
+ linkTextClassNames?: string;
11
+ }
12
+ export interface TableCellProps {
13
+ /** the react-table cell object */
14
+ cell: any;
15
+ /** is this the last column? */
7
16
  isLastCell: boolean;
17
+ /** do we want truncation/expand behavior? */
18
+ cellExpandable?: boolean;
19
+ /** current collapsed/expanded state */
20
+ expanded: boolean;
21
+ /** toggle callback */
22
+ onToggle: () => void;
23
+ /** text-slice length (default 30) */
24
+ maxCharacters?: number;
25
+ /** width in `ch` when expanded (default 50) */
26
+ cellMaxWidthWhenExpanded?: number;
27
+ /** background color utility (e.g. “bg-blue-50”) */
28
+ cellColor?: string;
29
+ /** extra wrapper classes */
30
+ additionalCellClassNames?: string;
31
+ /** if true, will show “Show more / Show less” */
8
32
  hasInfiniteScroll: boolean;
9
- globalTrimActive?: boolean;
10
- rowUuid?: string;
11
- columnInputs?: string[];
12
- rowHoverClasses?: string;
13
- linkText?: string;
33
+ /** override the collapsed UI */
34
+ toggleComponent?: React.ComponentType<ToggleProps>;
35
+ /** classes for both “more” & “less” links */
36
+ linkTextClassNames?: string;
14
37
  }
@@ -1,6 +1,6 @@
1
1
  import React, { ReactNode } from "react";
2
2
  import { Row } from "react-table";
3
- import { DataWithUUID } from "../TableCell";
3
+ import { DataWithUUID, ToggleProps } from "../TableCell";
4
4
  export interface TableRowProps<T extends DataWithUUID> {
5
5
  row: Row<T>;
6
6
  prepareRow: (row: Row<T>) => void;
@@ -13,18 +13,21 @@ export interface TableRowProps<T extends DataWithUUID> {
13
13
  cellExpandable?: boolean;
14
14
  expandedCells: Record<string, boolean>;
15
15
  toggleCell: (key: string) => void;
16
+ ToggleComponent?: React.ComponentType<ToggleProps>;
16
17
  hasDropDown?: boolean;
17
18
  onFetchRowData?: (uuid: string) => Promise<void> | void;
18
19
  loadingIndicator?: ReactNode;
19
20
  errorIndicator?: (error: Error) => ReactNode;
20
21
  expandedContent?: ReactNode;
21
- linkText?: string;
22
+ linkTextClassNames?: string;
22
23
  rowClassNames?: string;
23
24
  maxCharacters: number;
24
25
  expandedRowUuid?: string | null;
25
26
  onToggleRow?: (uuid: string) => void;
26
27
  cellColor: string;
27
28
  cellMaxWidthWhenExpanded: number;
29
+ additionalCellClassNames: string;
30
+ toggleComponent?: React.ComponentType<ToggleProps>;
28
31
  }
29
- declare const TableRow: <T extends DataWithUUID>({ row, prepareRow, activeIndex, activeRowColor, rowHoverClasses, rowClassNames, hasInfiniteScroll, rowUuid, onRowClick, expandedCells, toggleCell, hasDropDown, onFetchRowData, loadingIndicator, errorIndicator, expandedContent, linkText, expandedRowUuid, cellExpandable, onToggleRow, maxCharacters, cellColor, cellMaxWidthWhenExpanded, }: TableRowProps<T>) => import("react/jsx-runtime").JSX.Element;
32
+ declare const TableRow: <T extends DataWithUUID>({ row, prepareRow, activeIndex, activeRowColor, rowHoverClasses, rowClassNames, hasInfiniteScroll, rowUuid, onRowClick, expandedCells, toggleCell, hasDropDown, onFetchRowData, loadingIndicator, errorIndicator, expandedContent, expandedRowUuid, cellExpandable, onToggleRow, maxCharacters, cellColor, cellMaxWidthWhenExpanded, additionalCellClassNames, toggleComponent, linkTextClassNames, }: TableRowProps<T>) => import("react/jsx-runtime").JSX.Element;
30
33
  export default TableRow;
@@ -3,7 +3,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
3
  import { Fragment, useState } from "react";
4
4
  import { motion, AnimatePresence } from "framer-motion";
5
5
  import TableCell from "../TableCell";
6
- const TableRow = ({ row, prepareRow, activeIndex, activeRowColor = "bg-pink-100", rowHoverClasses = "hover:bg-navy-100 hover:cursor-pointer", rowClassNames = "", hasInfiniteScroll, rowUuid, onRowClick, expandedCells, toggleCell, hasDropDown = false, onFetchRowData, loadingIndicator, errorIndicator, expandedContent, linkText = "text-blue-500", expandedRowUuid = null, cellExpandable = false, onToggleRow, maxCharacters = 30, cellColor = "bg-blue-50", cellMaxWidthWhenExpanded = 50, }) => {
6
+ const TableRow = ({ row, prepareRow, activeIndex, activeRowColor = "bg-pink-100", rowHoverClasses = "hover:bg-navy-100 hover:cursor-pointer", rowClassNames = "", hasInfiniteScroll, rowUuid, onRowClick, expandedCells, toggleCell, hasDropDown = false, onFetchRowData, loadingIndicator, errorIndicator, expandedContent, expandedRowUuid = null, cellExpandable = false, onToggleRow, maxCharacters = 30, cellColor = "bg-blue-50", cellMaxWidthWhenExpanded = 50, additionalCellClassNames = "", toggleComponent = undefined, linkTextClassNames = "text-purple-500 ml-1 underline", }) => {
7
7
  prepareRow(row);
8
8
  const rowClasses = `border-primary${activeIndex === row.index ? ` activeRow ${activeRowColor}` : ""}`;
9
9
  /* keep fetch/loading local */
@@ -41,7 +41,7 @@ const TableRow = ({ row, prepareRow, activeIndex, activeRowColor = "bg-pink-100"
41
41
  : {};
42
42
  return (_jsxs(Fragment, { children: [_jsx("tr", { "data-testid": "table-row", className: `border-b border-b-navy-200 ${rowHoverClasses} ${rowClasses} ${rowClassNames}`, onClick: handleRowClick, ...safeRowProps, children: row.cells.map((cell, idx) => {
43
43
  const cellKey = `${rowUuid ?? "no-uuid"}-${cell.column.id}`;
44
- return (_jsx(TableCell, { cell: cell, isLastCell: idx === row.cells.length - 1, hasInfiniteScroll: hasInfiniteScroll, cellExpandable: cellExpandable, rowUuid: rowUuid, expanded: expandedCells[cellKey] ?? false, onToggle: () => toggleCell(cellKey), linkText: linkText, maxCharacters: maxCharacters, cellColor: cellColor, cellMaxWidthWhenExpanded: cellMaxWidthWhenExpanded }, cellKey));
44
+ return (_jsx(TableCell, { cell: cell, isLastCell: idx === row.cells.length - 1, hasInfiniteScroll: hasInfiniteScroll, cellExpandable: cellExpandable, expanded: expandedCells[cellKey] ?? false, onToggle: () => toggleCell(cellKey), linkTextClassNames: linkTextClassNames, maxCharacters: maxCharacters, cellColor: cellColor, cellMaxWidthWhenExpanded: cellMaxWidthWhenExpanded, additionalCellClassNames: additionalCellClassNames, toggleComponent: toggleComponent }, cellKey));
45
45
  }) }, rowUuid), hasDropDown && (_jsx(AnimatePresence, { children: isExpanded && (_jsx("tr", { "data-testid": "expanded-row", children: _jsx("td", { colSpan: row.cells.length, className: "p-0", children: _jsx(motion.div, { initial: { height: 0, opacity: 0 }, animate: { height: "auto", opacity: 1 }, exit: { height: 0, opacity: 0 }, transition: { duration: 0.3 }, className: "overflow-hidden w-full", children: isLoading ? (loadingIndicator ?? (_jsx("span", { children: "Loading..." }))) : error ? (errorIndicator ? (errorIndicator(error)) : (_jsxs("span", { className: "text-red-700", children: ["Error: ", error.message] }))) : (expandedContent ?? (_jsxs("span", { children: ["drop down \u2013 ", rowUuid] }))) }, "expanded-dropdown-content") }) })) }))] }));
46
46
  };
47
47
  export default TableRow;
@@ -96,7 +96,7 @@ const Template = (args) => {
96
96
  // ── **new** single-row expansion state ──
97
97
  const [expandedRowUuid, setExpandedRowUuid] = React.useState(null);
98
98
  const onToggleRow = React.useCallback((uuid) => setExpandedRowUuid((prev) => (prev === uuid ? null : uuid)), []);
99
- return (_jsx("table", { className: "min-w-[700px]", children: _jsx("tbody", { children: _jsx(TableRow, { cellColor: "", cellMaxWidthWhenExpanded: 0, row: undefined, prepareRow: function (row) {
99
+ return (_jsx("table", { className: "min-w-[700px]", children: _jsx("tbody", { children: _jsx(TableRow, { additionalCellClassNames: "", cellColor: "", cellMaxWidthWhenExpanded: 0, row: undefined, prepareRow: function (row) {
100
100
  throw new Error("Function not implemented.");
101
101
  }, ...args, expandedCells: expandedCells, toggleCell: toggleCell, hasInfiniteScroll: args.hasInfiniteScroll ?? true, onRowClick: args.onRowClick ?? (() => alert("from row")), expandedRowUuid: expandedRowUuid, onToggleRow: onToggleRow, maxCharacters: 30 }) }) }));
102
102
  };
@@ -124,5 +124,5 @@ export const MultipleRows = () => {
124
124
  const toggleCell = React.useCallback((key) => setExpandedCells((s) => ({ ...s, [key]: !s[key] })), []);
125
125
  const [expandedRowUuid, setExpandedRowUuid] = React.useState(null);
126
126
  const onToggleRow = React.useCallback((uuid) => setExpandedRowUuid((prev) => (prev === uuid ? null : uuid)), []);
127
- return (_jsx("table", { className: "min-w-[700px]", children: _jsxs("tbody", { children: [_jsx(TableRow, { row: mockRow, prepareRow: prepareRow, hasInfiniteScroll: true, onRowClick: () => alert("from row"), hasDropDown: true, rowUuid: "1", expandedContent: sampleData.expandedContent, expandedCells: expandedCells, toggleCell: toggleCell, expandedRowUuid: expandedRowUuid, onToggleRow: onToggleRow, maxCharacters: 30, cellColor: "", cellMaxWidthWhenExpanded: 0 }), _jsx(TableRow, { row: mockRow2, prepareRow: prepareRow, hasInfiniteScroll: true, onRowClick: () => alert("from row"), hasDropDown: false, rowUuid: "2", expandedContent: sampleData.expandedContent, expandedCells: expandedCells, toggleCell: toggleCell, expandedRowUuid: expandedRowUuid, onToggleRow: onToggleRow, cellExpandable: true, maxCharacters: 30, cellColor: "", cellMaxWidthWhenExpanded: 0 })] }) }));
127
+ return (_jsx("table", { className: "min-w-[700px]", children: _jsxs("tbody", { children: [_jsx(TableRow, { row: mockRow, prepareRow: prepareRow, hasInfiniteScroll: true, onRowClick: () => alert("from row"), hasDropDown: true, rowUuid: "1", expandedContent: sampleData.expandedContent, expandedCells: expandedCells, toggleCell: toggleCell, expandedRowUuid: expandedRowUuid, onToggleRow: onToggleRow, maxCharacters: 30, cellColor: "", cellMaxWidthWhenExpanded: 0, additionalCellClassNames: "" }), _jsx(TableRow, { row: mockRow2, prepareRow: prepareRow, hasInfiniteScroll: true, onRowClick: () => alert("from row"), hasDropDown: false, rowUuid: "2", expandedContent: sampleData.expandedContent, expandedCells: expandedCells, toggleCell: toggleCell, expandedRowUuid: expandedRowUuid, onToggleRow: onToggleRow, cellExpandable: true, maxCharacters: 30, cellColor: "", cellMaxWidthWhenExpanded: 0, additionalCellClassNames: "" })] }) }));
128
128
  };
@@ -25,7 +25,7 @@ describe("TableRow - Branch Coverage Tests", () => {
25
25
  throw new Error("Function not implemented.");
26
26
  }, expandedCells: undefined, toggleCell: function (key) {
27
27
  throw new Error("Function not implemented.");
28
- }, maxCharacters: 0, cellColor: "", cellMaxWidthWhenExpanded: 0 }) }) }));
28
+ }, maxCharacters: 0, cellColor: "", cellMaxWidthWhenExpanded: 0, additionalCellClassNames: "" }) }) }));
29
29
  expect(screen.getByTestId("table-row")).toHaveClass("activeRow");
30
30
  });
31
31
  it("covers isActive = false (row is NOT active)", () => {
@@ -33,14 +33,14 @@ describe("TableRow - Branch Coverage Tests", () => {
33
33
  throw new Error("Function not implemented.");
34
34
  }, expandedCells: undefined, toggleCell: function (key) {
35
35
  throw new Error("Function not implemented.");
36
- }, maxCharacters: 0, cellColor: "", cellMaxWidthWhenExpanded: 0 }) }) }));
36
+ }, maxCharacters: 0, cellColor: "", cellMaxWidthWhenExpanded: 0, additionalCellClassNames: "" }) }) }));
37
37
  expect(screen.getByTestId("table-row")).not.toHaveClass("activeRow");
38
38
  });
39
39
  it("covers onRowClick = defined + rowUuid = provided", () => {
40
40
  const mockOnRowClick = vi.fn();
41
41
  render(_jsx("table", { children: _jsx("tbody", { children: _jsx(TableRow, { row: baseMockRow, prepareRow: mockPrepareRow, onRowClick: mockOnRowClick, rowUuid: "some-uuid", hasInfiniteScroll: false, expandedCells: undefined, toggleCell: function (key) {
42
42
  throw new Error("Function not implemented.");
43
- }, maxCharacters: 0, cellColor: "", cellMaxWidthWhenExpanded: 0 }) }) }));
43
+ }, maxCharacters: 0, cellColor: "", cellMaxWidthWhenExpanded: 0, additionalCellClassNames: "" }) }) }));
44
44
  fireEvent.click(screen.getByTestId("table-row"));
45
45
  expect(mockOnRowClick).toHaveBeenCalledWith(baseMockRow.index, // 0
46
46
  "some-uuid", expect.anything() // Synthetic event
@@ -50,7 +50,7 @@ describe("TableRow - Branch Coverage Tests", () => {
50
50
  const mockOnRowClick = vi.fn();
51
51
  render(_jsx("table", { children: _jsx("tbody", { children: _jsx(TableRow, { row: baseMockRow, prepareRow: mockPrepareRow, onRowClick: mockOnRowClick, hasInfiniteScroll: false, expandedCells: undefined, toggleCell: function (key) {
52
52
  throw new Error("Function not implemented.");
53
- }, maxCharacters: 0, cellColor: "", cellMaxWidthWhenExpanded: 0 }) }) }));
53
+ }, maxCharacters: 0, cellColor: "", cellMaxWidthWhenExpanded: 0, additionalCellClassNames: "" }) }) }));
54
54
  fireEvent.click(screen.getByTestId("table-row"));
55
55
  expect(mockOnRowClick).toHaveBeenCalledWith(baseMockRow.index, // 0
56
56
  "", expect.anything());
@@ -60,7 +60,7 @@ describe("TableRow - Branch Coverage Tests", () => {
60
60
  throw new Error("Function not implemented.");
61
61
  }, expandedCells: undefined, toggleCell: function (key) {
62
62
  throw new Error("Function not implemented.");
63
- }, maxCharacters: 0, cellColor: "", cellMaxWidthWhenExpanded: 0 }) }) }));
63
+ }, maxCharacters: 0, cellColor: "", cellMaxWidthWhenExpanded: 0, additionalCellClassNames: "" }) }) }));
64
64
  // onRowClick not provided; just ensure no crash
65
65
  fireEvent.click(screen.getByTestId("table-row"));
66
66
  });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agilant/toga-blox",
3
3
  "private": false,
4
- "version": "1.0.199",
4
+ "version": "1.0.201",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",