@agilant/toga-blox 1.0.192 → 1.0.193

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.
@@ -0,0 +1 @@
1
+ export { default } from "./DropdownContainer";
@@ -1,2 +1 @@
1
- // export { default } from "./PageSection";
2
- // export * from "./PageSection.types";
1
+ export { default } from "./DropdownContainer";
@@ -19,21 +19,24 @@ const TableCell = ({ cell, isLastCell, hasInfiniteScroll, expanded, onToggle, li
19
19
  const stickyClass = isStickyColumn ? cell.column?.className || "" : "";
20
20
  const baseTd = "relative overflow-hidden font-light text-sm text-left px-5";
21
21
  const wrapper = "min-h-[40px] flex select-none" + (hasToggle ? " cursor-pointer" : "");
22
- return (_jsx("td", { ...cell.getCellProps({
23
- className: isLastCell ? "" : baseTd,
24
- style: cell.column?.sticky === "left"
25
- ? {
26
- position: "sticky",
27
- left: cell.column.style?.left || 0,
28
- zIndex: 10,
29
- }
30
- : {},
31
- }), className: isStickyColumn ? undefined : isLastCell ? "" : baseTd, children: _jsx("div", { ...(hasToggle ? { onClick: handleToggle } : {}), className: wrapper, children: hasToggle ? (!expanded ? (
22
+ // FIX: extract key before spreading props into <td>
23
+ const rawCellProps = cell.getCellProps({
24
+ className: isLastCell ? "" : baseTd,
25
+ style: cell.column?.sticky === "left"
26
+ ? {
27
+ position: "sticky",
28
+ left: cell.column.style?.left || 0,
29
+ zIndex: 10,
30
+ }
31
+ : {},
32
+ });
33
+ const { key: cellKey, ...safeCellProps } = Object.assign({}, rawCellProps);
34
+ return (_jsx("td", { ...safeCellProps, className: isStickyColumn ? undefined : isLastCell ? "" : baseTd, children: _jsx("div", { ...(hasToggle ? { onClick: handleToggle } : {}), className: wrapper, children: hasToggle ? (!expanded ? (
32
35
  /* collapsed view */
33
36
  _jsx("div", { className: "flex items-center group", children: _jsxs("span", { children: [truncated, "\u2026", _jsx("span", { className: `hidden group-hover:inline ${linkText}`, children: "Show more" })] }) })) : (
34
37
  /* expanded view */
35
38
  _jsxs("div", { className: "flex flex-col", children: [_jsx("span", { children: fullText }), _jsx("span", { className: linkText, children: "Show less" })] }))) : (
36
39
  /* no toggle required */
37
- cell.render("Cell")) }) }));
40
+ cell.render("Cell")) }) }, cellKey));
38
41
  };
39
42
  export default TableCell;
@@ -31,7 +31,15 @@ const TableRow = ({ row, prepareRow, activeIndex, activeRowColor = "bg-pink-100"
31
31
  }
32
32
  }
33
33
  };
34
- return (_jsxs(Fragment, { children: [_jsx("tr", { "data-testid": "table-row", className: `border-b border-b-navy-200 ${rowHoverClasses} ${rowClasses} ${rowClassNames}`, onClick: handleRowClick, ...(row.getRowProps ? row.getRowProps() : {}), children: row.cells.map((cell, idx) => {
34
+ // Fix: Key is discarded from the spread obj, react still gets key just not from spread i.e. key={rowUuid}
35
+ // Pull props ahead of time and separate out 'key'
36
+ // If row.getRowProps exists, call function, else use empty
37
+ // _ignoredKey extracts the key prop and stores it, it will be discarded
38
+ // ...safeRowProps gathers remaining props except key into obj using '...'
39
+ const { key: _ignoredKey, ...safeRowProps } = row.getRowProps
40
+ ? row.getRowProps()
41
+ : {};
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) => {
35
43
  const cellKey = `${rowUuid ?? "no-uuid"}-${cell.column.id}`;
36
44
  return (_jsx(TableCell, { cell: cell, isLastCell: idx === row.cells.length - 1, hasInfiniteScroll: hasInfiniteScroll, rowUuid: rowUuid, expanded: expandedCells[cellKey] ?? false, onToggle: () => toggleCell(cellKey), linkText: linkText }, cellKey));
37
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") }) })) }))] }));
@@ -73,7 +73,7 @@ export function baseFormatTableData(columnTitles, accessors, columnConfigs, rend
73
73
  * Helper to wrap content in a <div> or <a> if `linkClasses` exist
74
74
  */
75
75
  function wrapContent(config, value, content, position) {
76
- return (_jsx("div", { style: { display: "flex", alignItems: "center" }, className: "flex w-full", children: config.linkClasses ? (_jsxs("a", { href: "#", className: `flex ${config.linkClasses}`, onClick: (e) => e.stopPropagation(), children: [position === "left" && content, typeof value === "string" ? _jsx("p", { children: value }) : value, position === "right" && content] })) : (_jsxs(_Fragment, { children: [position === "left" && content, typeof value === "string" ? _jsx("p", { children: value }) : value, position === "right" && content] })) }));
76
+ return (_jsx("div", { style: { display: "flex", alignItems: "center" }, className: "flex w-full", children: config.linkClasses ? (_jsxs("a", { href: "#", className: `flex ${config.linkClasses}`, onClick: (e) => e.stopPropagation(), children: [position === "left" && content, typeof value === "string" ? (_jsx("span", { children: value })) : (value), position === "right" && content] })) : (_jsxs(_Fragment, { children: [position === "left" && content, typeof value === "string" ? (_jsx("span", { children: value })) : (value), position === "right" && content] })) }));
77
77
  }
78
78
  // ----------------------------------------------------------------------
79
79
  // Build final columns from columnTitles + configs
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@agilant/toga-blox",
3
3
  "private": false,
4
- "version": "1.0.192",
4
+ "version": "1.0.193",
5
5
  "description": "",
6
6
  "main": "dist/index.js",
7
7
  "types": "dist/index.d.ts",