@homebound/beam 2.329.0 → 2.331.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.
@@ -235,7 +235,7 @@ function renderDiv(style, id, columns, visibleDataRows, keptSelectedRows, firstR
235
235
  ...Css_1.Css.if(stickyHeader).sticky.topPx(stickyOffset).z(utils_1.zIndices.stickyHeader).$,
236
236
  }, children: tableHeadRows }), (0, jsx_runtime_1.jsxs)("div", { css: {
237
237
  ...(style.betweenRowsCss ? Css_1.Css.addIn(`& > div > *`, style.betweenRowsCss).$ : {}),
238
- ...(style.firstNonHeaderRowCss ? Css_1.Css.addIn(`& > div:first-of-type > *`, style.firstNonHeaderRowCss).$ : {}),
238
+ ...(style.firstNonHeaderRowCss ? Css_1.Css.addIn(`& > div:first-of-type`, style.firstNonHeaderRowCss).$ : {}),
239
239
  ...(style.lastRowCss && Css_1.Css.addIn("& > div:last-of-type", style.lastRowCss).$),
240
240
  }, children: [keptSelectedRows, firstRowMessage && ((0, jsx_runtime_1.jsx)("div", { css: { ...style.firstRowMessageCss }, "data-gridrow": true, children: firstRowMessage })), visibleDataRows] })] }));
241
241
  }
@@ -245,7 +245,7 @@ function renderTable(style, id, columns, visibleDataRows, keptSelectedRows, firs
245
245
  ...Css_1.Css.w100.add("borderCollapse", "separate").add("borderSpacing", "0").$,
246
246
  ...Css_1.Css.addIn("& > tbody > tr > * ", style.betweenRowsCss || {})
247
247
  // removes border between header and second row
248
- .addIn("& > tbody > tr:first-of-type > *", style.firstNonHeaderRowCss || {}).$,
248
+ .addIn("& > tbody > tr:first-of-type", style.firstNonHeaderRowCss || {}).$,
249
249
  ...Css_1.Css.addIn("& > tbody > tr:last-of-type", style.lastRowCss).$,
250
250
  ...Css_1.Css.addIn("& > thead > tr:first-of-type", style.firstRowCss).$,
251
251
  ...style.rootCss,
@@ -364,7 +364,7 @@ const VirtualRoot = (0, memoize_one_1.default)((gs, _columns, id, xss) => {
364
364
  ...(isHeader
365
365
  ? Css_1.Css.addIn("& > div:first-of-type > *", gs.firstRowCss).$
366
366
  : {
367
- ...Css_1.Css.addIn("& > div:first-of-type > *", gs.firstNonHeaderRowCss).$,
367
+ ...Css_1.Css.addIn("& > div:first-of-type", gs.firstNonHeaderRowCss).$,
368
368
  ...Css_1.Css.addIn("& > div:last-of-type > *", gs.lastRowCss).$,
369
369
  }),
370
370
  ...gs.rootCss,
@@ -13,6 +13,8 @@ export interface GridStyle {
13
13
  lastRowCss?: Properties;
14
14
  /** Applied on the first row of the table (could be the Header or Totals row). */
15
15
  firstRowCss?: Properties;
16
+ /** Applied to every non-header row of the table */
17
+ nonHeaderRowCss?: Properties;
16
18
  /** Applied to the first non-header row, i.e. if you want to cancel out `betweenRowsCss`. */
17
19
  firstNonHeaderRowCss?: Properties;
18
20
  /** Applied to all cell divs (via a selector off the base div). */
@@ -37,7 +39,9 @@ export interface GridStyle {
37
39
  /** Applied if there is a fallback/overflow message showing. */
38
40
  firstRowMessageCss?: Properties;
39
41
  /** Applied on hover if a row has a rowLink/onClick set. */
40
- rowHoverColor?: Palette;
42
+ rowHoverColor?: Palette | "none";
43
+ /** Applied on hover of a row */
44
+ nonHeaderRowHoverCss?: Properties;
41
45
  /** Default content to put into an empty cell */
42
46
  emptyCell?: ReactNode;
43
47
  presentationSettings?: Pick<PresentationFieldProps, "borderless" | "typeScale"> & Pick<PresentationContextProps, "wrap">;
@@ -45,6 +49,8 @@ export interface GridStyle {
45
49
  minWidthPx?: number;
46
50
  /** Css to apply at each level of a parent/child nested table. */
47
51
  levels?: Record<number, {
52
+ /** Number of pixels to indent the row. This value will be subtracted from the "first content column" width. First content column is the first column that is not an 'action' column (i.e. non-checkbox or non-collapse button column) */
53
+ rowIndent?: number;
48
54
  cellCss?: Properties;
49
55
  firstContentColumn?: Properties;
50
56
  }>;
@@ -92,17 +92,19 @@ exports.condensedStyle = {
92
92
  exports.cardStyle = {
93
93
  ...exports.defaultStyle,
94
94
  betweenRowsCss: {},
95
- firstNonHeaderRowCss: Css_1.Css.mt2.$,
96
- cellCss: Css_1.Css.p2.my1.bt.bb.bGray400.$,
97
- firstCellCss: Css_1.Css.bl.add({ borderTopLeftRadius: "4px", borderBottomLeftRadius: "4px" }).$,
98
- lastCellCss: Css_1.Css.br.add({ borderTopRightRadius: "4px", borderBottomRightRadius: "4px" }).$,
95
+ nonHeaderRowCss: Css_1.Css.br4.overflowHidden.ba.bGray400.mt2.add("transition", "all 240ms").$,
96
+ firstRowCss: Css_1.Css.bl.br.bGray200.borderRadius("8px 8px 0 0").overflowHidden.$,
97
+ cellCss: Css_1.Css.p2.$,
99
98
  // Undo the card look & feel for the header
100
99
  headerCellCss: {
101
100
  ...exports.defaultStyle.headerCellCss,
102
- ...Css_1.Css.add({
103
- border: "none",
104
- borderRadius: "unset",
105
- }).p1.m0.xsMd.gray700.$,
101
+ ...Css_1.Css.p1.m0.xsMd.gray700.$,
102
+ },
103
+ rowHoverColor: "none",
104
+ nonHeaderRowHoverCss: Css_1.Css.bshHover.bGray700.$,
105
+ levels: {
106
+ 1: { rowIndent: 24 },
107
+ 2: { rowIndent: 48 },
106
108
  },
107
109
  };
108
110
  function resolveStyles(style) {
@@ -13,7 +13,7 @@ const Css_1 = require("../../../Css");
13
13
  const utils_2 = require("../../../utils");
14
14
  // We extract Row to its own mini-component primarily so we can React.memo'ize it.
15
15
  function RowImpl(props) {
16
- var _a, _b;
16
+ var _a, _b, _c;
17
17
  const { as, rs, style, rowStyles, columnSizes, getCount, cellHighlight, omitRowHover, hasExpandableHeader, ...others } = props;
18
18
  const { tableState } = (0, react_1.useContext)(TableState_1.TableStateContext);
19
19
  // We're wrapped in observer, so can access these without useComputeds
@@ -28,14 +28,22 @@ function RowImpl(props) {
28
28
  const RowTag = as === "table" ? "tr" : "div";
29
29
  const sortOn = (_a = tableState.sortConfig) === null || _a === void 0 ? void 0 : _a.on;
30
30
  const revealOnRowHoverClass = "revealOnRowHover";
31
- const showRowHoverColor = !utils_1.reservedRowKinds.includes(row.kind) && !omitRowHover;
31
+ const showRowHoverColor = !utils_1.reservedRowKinds.includes(row.kind) && !omitRowHover && style.rowHoverColor !== "none";
32
32
  const rowStyleCellCss = (0, utils_1.maybeApplyFunction)(row, rowStyle === null || rowStyle === void 0 ? void 0 : rowStyle.cellCss);
33
+ const levelIndent = style.levels && ((_b = style.levels[level]) === null || _b === void 0 ? void 0 : _b.rowIndent);
33
34
  const rowCss = {
35
+ ...(!utils_1.reservedRowKinds.includes(row.kind) && style.nonHeaderRowCss),
34
36
  // Optionally include the row hover styles, by default they should be turned on.
35
37
  ...(showRowHoverColor && {
36
38
  // Even though backgroundColor is set on the cellCss, the hover target is the row.
37
- "&:hover > *": Css_1.Css.bgColor((_b = style.rowHoverColor) !== null && _b !== void 0 ? _b : Css_1.Palette.Blue100).$,
39
+ "&:hover > *": Css_1.Css.bgColor((_c = style.rowHoverColor) !== null && _c !== void 0 ? _c : Css_1.Palette.Blue100).$,
38
40
  }),
41
+ ...(!utils_1.reservedRowKinds.includes(row.kind) &&
42
+ style.nonHeaderRowHoverCss && {
43
+ // Need to spread this to make TS happy.
44
+ ":hover": { ...style.nonHeaderRowHoverCss },
45
+ }),
46
+ ...(levelIndent && Css_1.Css.mlPx(levelIndent).$),
39
47
  // For virtual tables use `display: flex` to keep all cells on the same row. For each cell in the row use `flexNone` to ensure they stay their defined widths
40
48
  ...(as === "table" ? {} : Css_1.Css.relative.df.fg1.fs1.addIn("&>*", Css_1.Css.flexNone.$).$),
41
49
  // Apply `cursorPointer` to the row if it has a link or `onClick` value.
@@ -189,7 +197,8 @@ function RowImpl(props) {
189
197
  // Apply cell highlight styles to active cell and hover
190
198
  ...Css_1.Css.if(applyCellHighlight && isCellActive).br4.boxShadow(`inset 0 0 0 1px ${Css_1.Palette.Blue700}`).$,
191
199
  // Define the width of the column on each cell. Supports col spans.
192
- width: `calc(${columnSizes.slice(columnIndex, columnIndex + currentColspan).join(" + ")})`,
200
+ // If we have a 'levelIndent' defined, then subtract that amount from the first content column's width to ensure all columns will still line up properly
201
+ width: `calc(${columnSizes.slice(columnIndex, columnIndex + currentColspan).join(" + ")}${applyFirstContentColumnStyles && levelIndent ? ` - ${levelIndent}px` : ""})`,
193
202
  ...(typeof column.mw === "string" ? Css_1.Css.mw(column.mw).$ : {}),
194
203
  };
195
204
  const cellClassNames = revealOnRowHover ? revealOnRowHoverClass : undefined;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homebound/beam",
3
- "version": "2.329.0",
3
+ "version": "2.331.0",
4
4
  "author": "Homebound",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",