@homebound/beam 2.241.1 → 2.242.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.
@@ -28,7 +28,11 @@ function memoizedTableStyles() {
28
28
  emptyCell: "-",
29
29
  firstRowMessageCss: Css_1.Css.tc.py3.$,
30
30
  headerCellCss: {
31
- ...Css_1.Css.gray700.xsMd.bgGray200.aic.nowrap.pxPx(12).hPx(40).$,
31
+ // We want to support headers having two lines of wrapped text, and could add a `lineClamp2` here, but
32
+ // lineClamp requires `display: webkit-box`, which disables `align-items: center` (requires `display: flex/grid`)
33
+ // Header's will add `lineClamp2` more locally in their renders.
34
+ // Also `unset`-ing the white-space: nowrap defined in `cellCss` below.
35
+ ...Css_1.Css.gray700.xsMd.bgGray200.aic.pxPx(12).whiteSpace("unset").hPx(40).$,
32
36
  ...(allWhite && Css_1.Css.bgWhite.$),
33
37
  },
34
38
  totalsCellCss: Css_1.Css.bgWhite.gray700.smMd.hPx(exports.totalsRowHeight).pPx(12).boxShadow("none").$,
@@ -33,6 +33,6 @@ function SortHeader(props) {
33
33
  .if(isHovered || sorted !== undefined)
34
34
  .visibility("visible").$,
35
35
  }, inc: 2, ...tid.icon }) }));
36
- return ((0, jsx_runtime_1.jsxs)("div", { ...tid, css: { ...Css_1.Css.df.aic.h100.cursorPointer.selectNone.$, ...xss }, ...hoverProps, onClick: toggleSort, children: [iconOnLeft && icon, content, !iconOnLeft && icon] }));
36
+ return ((0, jsx_runtime_1.jsxs)("div", { ...tid, css: { ...Css_1.Css.df.aic.h100.cursorPointer.selectNone.$, ...xss }, ...hoverProps, onClick: toggleSort, children: [iconOnLeft && icon, (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.lineClamp2.$, children: content }), !iconOnLeft && icon] }));
37
37
  }
38
38
  exports.SortHeader = SortHeader;
@@ -27,7 +27,7 @@ export type GridCellContent = {
27
27
  css?: Properties;
28
28
  /** Allows cell to reveal content when the user hovers over a row. Content must be wrapped in an element in order to be hidden. IE <div>{value}</div>*/
29
29
  revealOnRowHover?: true;
30
- /** Tooltip to add to a cell. **Only Works on Headers** */
30
+ /** Tooltip to add to a cell */
31
31
  tooltip?: ReactNode;
32
32
  };
33
33
  /** Allows rendering a specific cell. */
@@ -35,7 +35,7 @@ function useSetupColumnSizes(style, columns, resizeRef, expandedColumnIds) {
35
35
  const setTableAndColumnWidths = (0, react_1.useCallback)((width) => {
36
36
  setTableWidth(width);
37
37
  setColumnSizes((0, columns_1.calcColumnSizes)(columns, width, style.minWidthPx, expandedColumnIds));
38
- }, [setTableWidth, setColumnSizes, columns, style]);
38
+ }, [setTableWidth, setColumnSizes, columns, style, expandedColumnIds]);
39
39
  // Used to recalculate our columns sizes when columns change
40
40
  (0, react_1.useEffect)(() => {
41
41
  var _a;
@@ -41,7 +41,10 @@ function toContent(maybeContent, isHeader, canSortColumn, isClientSideSorting, s
41
41
  else if (content && typeof content === "string" && isExpandableHeader) {
42
42
  return (0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.lineClamp2.$, children: content });
43
43
  }
44
- else if (content && ((_c = style === null || style === void 0 ? void 0 : style.presentationSettings) === null || _c === void 0 ? void 0 : _c.wrap) === false && typeof content === "string") {
44
+ else if (!isContentEmpty(content) && isHeader && typeof content === "string") {
45
+ return ((0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.lineClamp2.$, title: content, children: content }));
46
+ }
47
+ else if (!isHeader && content && ((_c = style === null || style === void 0 ? void 0 : style.presentationSettings) === null || _c === void 0 ? void 0 : _c.wrap) === false && typeof content === "string") {
45
48
  // In order to truncate the text properly, then we need to wrap it in another element
46
49
  // as our cell element is a flex container, which don't allow for applying truncation styles directly on it.
47
50
  return ((0, jsx_runtime_1.jsx)("span", { css: Css_1.Css.truncate.mw0.$, title: content, children: content }));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.241.1",
3
+ "version": "2.242.0",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",