@homebound/beam 2.417.6 → 2.417.7

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/dist/index.cjs CHANGED
@@ -7525,21 +7525,19 @@ function memoizedTableStyles() {
7525
7525
  cellCss: {
7526
7526
  ...Css[cellTypography].gray900.bgWhite.ai(alignItems).pxPx(12).boxShadow(`inset 0 -1px 0 ${"rgba(236, 235, 235, 1)" /* Gray200 */}`).$,
7527
7527
  ...rowHeight === "flexible" ? Css.pyPx(12).$ : Css.wsnw.hPx(inlineEditing ? 48 : 36).$,
7528
- ...cellHighlight ? { "&:hover": Css.bgGray100.$ } : {},
7529
- ...bordered && { "&:first-child": Css.bl.bcGray200.$, "&:last-child": Css.br.bcGray200.$ }
7528
+ ...cellHighlight ? { "&:hover": Css.bgGray100.$ } : {}
7530
7529
  },
7531
- firstRowCss: {
7532
- ...Css.addIn("& > *:first-of-type", Css.borderRadius("8px 0 0 0 ").$).addIn(
7533
- "& > *:last-of-type",
7534
- Css.borderRadius("0 8px 0 0").$
7535
- ).$,
7536
- ...bordered && Css.addIn("& > *", Css.bt.bcGray200.$).$
7537
- },
7538
- // Only apply border radius styles to the last row when using the `bordered` style table.
7539
- lastRowCss: bordered ? Css.addIn("& > *:first-of-type", Css.borderRadius("0 0 0 8px").$).addIn(
7540
- "& > *:last-of-type",
7541
- Css.borderRadius("0 0 8px 0").$
7542
- ).$ : Css.addIn("> *", Css.bsh0.$).$,
7530
+ firstCellCss: bordered ? Css.bl.bcGray200.$ : void 0,
7531
+ lastCellCss: bordered ? Css.br.bcGray200.$ : void 0,
7532
+ firstRowCellCss: bordered ? Css.bt.bcGray200.$ : void 0,
7533
+ firstRowFirstCellCss: Css.borderRadius("8px 0 0 0 ").$,
7534
+ firstRowLastCellCss: Css.borderRadius("0 8px 0 0").$,
7535
+ // Keep `betweenRowsCss` on all body rows, but on the final body row
7536
+ // remove the inset shadow and, when bordered, replace it with a true bottom border.
7537
+ lastRowCellCss: bordered ? Css.bsh0.bb.bcGray200.$ : Css.bsh0.$,
7538
+ // Only apply bottom corner radii to the final body-row cells when using `bordered`.
7539
+ lastRowFirstCellCss: bordered ? Css.borderRadius("0 0 0 8px").$ : void 0,
7540
+ lastRowLastCellCss: bordered ? Css.borderRadius("0 0 8px 0").$ : void 0,
7543
7541
  presentationSettings: {
7544
7542
  borderless: true,
7545
7543
  typeScale: "xs",
@@ -7558,6 +7556,7 @@ function memoizedTableStyles() {
7558
7556
  var getTableStyles = memoizedTableStyles();
7559
7557
  var totalsRowHeight = 40;
7560
7558
  var expandableHeaderRowHeight = 40;
7559
+ var tableRowPrintBreakCss = Css.add("pageBreakAfter", "auto").add("pageBreakInside", "avoid").$;
7561
7560
  var defaultStyle = getTableStyles({});
7562
7561
  var condensedStyle = {
7563
7562
  ...getTableStyles({ rowHeight: "fixed" }),
@@ -7826,10 +7825,10 @@ function applyRowFn(column2, row, api, level, expanded, dragData) {
7826
7825
  var ASC = "ASC";
7827
7826
  var DESC = "DESC";
7828
7827
  var emptyCell = { content: () => /* @__PURE__ */ (0, import_jsx_runtime31.jsx)(import_jsx_runtime31.Fragment, {}), value: "" };
7829
- function getFirstOrLastCellCss(style, columnIndex, columns) {
7828
+ function getFirstOrLastCellCss(style, columnIndex, columns, colspan = 1) {
7830
7829
  return {
7831
7830
  ...columnIndex === 0 ? style.firstCellCss : {},
7832
- ...columnIndex === columns.length - 1 ? style.lastCellCss : {}
7831
+ ...columnIndex + colspan >= columns.length ? style.lastCellCss : {}
7833
7832
  };
7834
7833
  }
7835
7834
  function isJSX(content) {
@@ -8220,7 +8219,7 @@ function ColumnResizeHandle({
8220
8219
  var import_react32 = require("react");
8221
8220
  var import_jsx_runtime33 = require("@emotion/react/jsx-runtime");
8222
8221
  function KeptGroupRow(props) {
8223
- const { as, columnSizes, style, row, colSpan } = props;
8222
+ const { as, columnSizes, style, row, colSpan, isLastBodyRow } = props;
8224
8223
  const CellTag = as === "table" ? "td" : "div";
8225
8224
  const { tableState } = (0, import_react32.useContext)(TableStateContext);
8226
8225
  const numHiddenSelectedRows = useComputed(() => tableState.keptRows.length, [tableState]);
@@ -8229,6 +8228,10 @@ function KeptGroupRow(props) {
8229
8228
  {
8230
8229
  css: {
8231
8230
  ...style.cellCss,
8231
+ ...style.betweenRowsCss,
8232
+ ...isLastBodyRow && style.lastRowCellCss,
8233
+ ...isLastBodyRow && style.lastRowFirstCellCss,
8234
+ ...isLastBodyRow && style.lastRowLastCellCss,
8232
8235
  ...style.keptGroupRowCss,
8233
8236
  ...Css.pl0.w(`calc(${columnSizes.join(" + ")})`).$
8234
8237
  },
@@ -8543,6 +8546,9 @@ function RowImpl(props) {
8543
8546
  cellHighlight,
8544
8547
  omitRowHover,
8545
8548
  hasExpandableHeader,
8549
+ isFirstHeadRow,
8550
+ isFirstBodyRow,
8551
+ isLastBodyRow,
8546
8552
  resizedWidths,
8547
8553
  setResizedWidth,
8548
8554
  disableColumnResizing = true,
@@ -8561,6 +8567,8 @@ function RowImpl(props) {
8561
8567
  const isTotals = row.kind === TOTALS;
8562
8568
  const isExpandableHeader = row.kind === EXPANDABLE_HEADER;
8563
8569
  const isKeptGroupRow = row.kind === KEPT_GROUP;
8570
+ const isBodyRow = !isHeader && !isTotals && !isExpandableHeader;
8571
+ const isFirstHeadCellRow = isExpandableHeader || !hasExpandableHeader && (isHeader || isTotals);
8564
8572
  const rowStyle = rowStyles?.[row.kind];
8565
8573
  const RowTag = as === "table" ? "tr" : "div";
8566
8574
  const sortOn = tableState.sortConfig?.on;
@@ -8576,6 +8584,9 @@ function RowImpl(props) {
8576
8584
  };
8577
8585
  const rowCss = {
8578
8586
  ...!reservedRowKinds.includes(row.kind) && style.nonHeaderRowCss,
8587
+ ...isFirstBodyRow && style.firstBodyRowCss,
8588
+ ...isFirstHeadRow && style.firstRowCss,
8589
+ ...as === "table" && tableRowPrintBreakCss,
8579
8590
  // Optionally include the row hover styles, by default they should be turned on.
8580
8591
  ...showRowHoverColor && {
8581
8592
  // Even though backgroundColor is set on the cellCss, the hover target is the row.
@@ -8588,6 +8599,7 @@ function RowImpl(props) {
8588
8599
  ...levelIndent && Css.mlPx(levelIndent).$,
8589
8600
  // For virtual tables use `display: flex` to keep all cells on the same row.
8590
8601
  ...as === "table" ? {} : Css.relative.df.fg1.fs1.$,
8602
+ ...isLastBodyRow && style.lastRowCss,
8591
8603
  // Apply `cursorPointer` to the row if it has a link or `onClick` value.
8592
8604
  ...(rowStyle?.rowLink || rowStyle?.onClick) && { "&:hover": Css.cursorPointer.$ },
8593
8605
  ...maybeApplyFunction(row, rowStyle?.rowCss),
@@ -8608,7 +8620,17 @@ function RowImpl(props) {
8608
8620
  [onDragOver]
8609
8621
  );
8610
8622
  const onDragOverDebounced = (0, import_use_debounce4.useDebouncedCallback)(dragOverCallback, 100);
8611
- const RowContent = () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RowTag, { css: rowCss, ...others, "data-gridrow": true, ...getCount(row.id), ref, className: BorderHoverParent, children: isKeptGroupRow ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(KeptGroupRow, { as, style, columnSizes, row, colSpan: columns.length }) : columns.map((column2, columnIndex) => {
8623
+ const RowContent = () => /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(RowTag, { css: rowCss, ...others, "data-gridrow": true, ...getCount(row.id), ref, className: BorderHoverParent, children: isKeptGroupRow ? /* @__PURE__ */ (0, import_jsx_runtime34.jsx)(
8624
+ KeptGroupRow,
8625
+ {
8626
+ as,
8627
+ style,
8628
+ columnSizes,
8629
+ row,
8630
+ colSpan: columns.length,
8631
+ isLastBodyRow
8632
+ }
8633
+ ) : columns.map((column2, columnIndex) => {
8612
8634
  const maybeExpandedColumn = expandColumnHidden ? columns[columnIndex - 1] : column2;
8613
8635
  const isExpanded = tableState.isExpandedColumn(maybeExpandedColumn.id);
8614
8636
  if (column2.hideOnExpand && isExpanded) {
@@ -8692,8 +8714,16 @@ function RowImpl(props) {
8692
8714
  ...maybeStickyColumnStyles,
8693
8715
  // Apply any static/all-cell styling
8694
8716
  ...style.cellCss,
8717
+ // Apply between-row cell styling for body rows.
8718
+ ...isBodyRow && style.betweenRowsCss,
8719
+ ...isFirstHeadCellRow && style.firstRowCellCss,
8720
+ ...isLastBodyRow && style.lastRowCellCss,
8695
8721
  // Then override with first/last cell styling
8696
- ...getFirstOrLastCellCss(style, columnIndex, columns),
8722
+ ...getFirstOrLastCellCss(style, columnIndex, columns, currentColspan),
8723
+ ...columnIndex === 0 && isFirstHeadCellRow && style.firstRowFirstCellCss,
8724
+ ...columnIndex === columns.length - 1 && isFirstHeadCellRow && style.firstRowLastCellCss,
8725
+ ...columnIndex === 0 && isLastBodyRow && style.lastRowFirstCellCss,
8726
+ ...columnIndex === columns.length - 1 && isLastBodyRow && style.lastRowLastCellCss,
8697
8727
  // Then override with per-cell/per-row justification
8698
8728
  ...justificationCss,
8699
8729
  // Then apply any header-specific override
@@ -8709,7 +8739,7 @@ function RowImpl(props) {
8709
8739
  // Only apply if not the last column in the table AND when this column is the last column in the group of expandable column or not expanded AND
8710
8740
  ...hasExpandableHeader && columnIndex + currentColspan < columns.length && (isHeader || isTotals) && currentExpandedColumnCount === 0 && Css.boxShadow(`inset -1px -1px 0 ${"rgba(236, 235, 235, 1)" /* Gray200 */}`).$,
8711
8741
  // Or level-specific styling
8712
- ...!isHeader && !isTotals && !isExpandableHeader && levelStyle?.cellCss,
8742
+ ...isBodyRow && levelStyle?.cellCss,
8713
8743
  // Level specific styling for the first content column
8714
8744
  ...applyFirstContentColumnStyles && levelStyle?.firstContentColumn,
8715
8745
  // The specific cell's css (if any from GridCellContent)
@@ -8904,6 +8934,7 @@ function TextFieldBase(props) {
8904
8934
  },
8905
8935
  input: {
8906
8936
  ...Css.w100.mw0.outline0.fg1.bgTransparent.$,
8937
+ // Keep `addIn` for `::selection` until we finish the StyleX migration.
8907
8938
  // Not using Truss's inline `if` statement here because `addIn` properties do not respect the if statement.
8908
8939
  ...contrast && !inputStylePalette && Css.addIn("&::selection", Css.bgGray800.$).$,
8909
8940
  // For "multiline" fields we add top and bottom padding of 7px for compact, or 11px for non-compact, to properly match the height of the single line fields
@@ -14138,7 +14169,25 @@ function GridTable(props) {
14138
14169
  let visibleDataRows2 = [];
14139
14170
  const { visibleRows } = tableState;
14140
14171
  const hasExpandableHeader = visibleRows.some((rs) => rs.row.id === EXPANDABLE_HEADER);
14172
+ const bodyRowsCount = visibleRows.filter((rs) => ![HEADER, EXPANDABLE_HEADER, TOTALS].includes(rs.kind)).length;
14173
+ const onlyKeptBodyRows = bodyRowsCount > 0 && visibleRows.every(
14174
+ (rs) => (
14175
+ // For our purposes, "body rows" are any non-header / non-totals rows.
14176
+ [HEADER, EXPANDABLE_HEADER, TOTALS].includes(rs.kind) || rs.isKept || rs.kind === KEPT_GROUP
14177
+ )
14178
+ );
14179
+ let bodyRowsSeen = 0;
14180
+ let foundFirstBodyRow = false;
14181
+ let foundFirstHeadRow = false;
14141
14182
  visibleRows.forEach((rs) => {
14183
+ const isHeadRow = [HEADER, EXPANDABLE_HEADER, TOTALS].includes(rs.kind);
14184
+ const isFirstHeadRow = isHeadRow && !foundFirstHeadRow;
14185
+ const isBodyRow = ![HEADER, EXPANDABLE_HEADER, TOTALS].includes(rs.kind);
14186
+ const isFirstBodyRow = isBodyRow && !foundFirstBodyRow;
14187
+ if (isHeadRow) foundFirstHeadRow = true;
14188
+ if (isBodyRow) bodyRowsSeen += 1;
14189
+ if (isBodyRow) foundFirstBodyRow = true;
14190
+ const isLastBodyRow = isBodyRow && bodyRowsSeen === bodyRowsCount && !onlyKeptBodyRows;
14142
14191
  const row = /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
14143
14192
  Row,
14144
14193
  {
@@ -14157,6 +14206,9 @@ function GridTable(props) {
14157
14206
  cellHighlight: "cellHighlight" in maybeStyle && maybeStyle.cellHighlight === true,
14158
14207
  omitRowHover: "rowHover" in maybeStyle && maybeStyle.rowHover === false,
14159
14208
  hasExpandableHeader,
14209
+ isFirstHeadRow,
14210
+ isFirstBodyRow,
14211
+ isLastBodyRow,
14160
14212
  resizedWidths,
14161
14213
  setResizedWidth: handleColumnResize,
14162
14214
  disableColumnResizing,
@@ -14255,27 +14307,30 @@ function renderDiv(style, id, columns, visibleDataRows, keptSelectedRows, firstR
14255
14307
  "div",
14256
14308
  {
14257
14309
  css: {
14258
- ...style.firstRowCss && Css.addIn("& > div:first-of-type", style.firstRowCss).$,
14259
14310
  ...Css.if(stickyHeader).sticky.topPx(stickyOffset).z(zIndices.stickyHeader).$
14260
14311
  },
14261
14312
  children: tableHeadRows
14262
14313
  }
14263
14314
  ),
14264
- /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)(
14265
- "div",
14266
- {
14267
- css: {
14268
- ...style.betweenRowsCss ? Css.addIn(`& > div > *`, style.betweenRowsCss).$ : {},
14269
- ...style.firstNonHeaderRowCss ? Css.addIn(`& > div:first-of-type`, style.firstNonHeaderRowCss).$ : {},
14270
- ...style.lastRowCss && Css.addIn("& > div:last-of-type", style.lastRowCss).$
14271
- },
14272
- children: [
14273
- keptSelectedRows,
14274
- firstRowMessage && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { css: { ...style.firstRowMessageCss }, "data-gridrow": true, children: firstRowMessage }),
14275
- visibleDataRows
14276
- ]
14277
- }
14278
- )
14315
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("div", { children: [
14316
+ keptSelectedRows,
14317
+ firstRowMessage && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
14318
+ "div",
14319
+ {
14320
+ css: {
14321
+ ...keptSelectedRows.length === 0 && style.firstBodyRowCss,
14322
+ ...style.firstRowMessageCss,
14323
+ ...visibleDataRows.length === 0 && style.lastRowCss,
14324
+ ...visibleDataRows.length === 0 && style.lastRowCellCss,
14325
+ ...visibleDataRows.length === 0 && style.lastRowFirstCellCss,
14326
+ ...visibleDataRows.length === 0 && style.lastRowLastCellCss
14327
+ },
14328
+ "data-gridrow": true,
14329
+ children: firstRowMessage
14330
+ }
14331
+ ),
14332
+ visibleDataRows
14333
+ ] })
14279
14334
  ]
14280
14335
  }
14281
14336
  );
@@ -14287,10 +14342,6 @@ function renderTable(style, id, columns, visibleDataRows, keptSelectedRows, firs
14287
14342
  ref: tableContainerRef,
14288
14343
  css: {
14289
14344
  ...Css.w100.add("borderCollapse", "separate").add("borderSpacing", "0").$,
14290
- ...Css.addIn("& tr ", { pageBreakAfter: "auto", pageBreakInside: "avoid" }).$,
14291
- ...Css.addIn("& > tbody > tr > * ", style.betweenRowsCss || {}).addIn("& > tbody > tr:first-of-type", style.firstNonHeaderRowCss || {}).$,
14292
- ...Css.addIn("& > tbody > tr:last-of-type", style.lastRowCss).$,
14293
- ...Css.addIn("& > thead > tr:first-of-type", style.firstRowCss).$,
14294
14345
  ...style.rootCss,
14295
14346
  ...style.minWidthPx ? Css.mwPx(style.minWidthPx).$ : {},
14296
14347
  ...xss
@@ -14300,7 +14351,30 @@ function renderTable(style, id, columns, visibleDataRows, keptSelectedRows, firs
14300
14351
  /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("thead", { css: Css.if(stickyHeader).sticky.topPx(stickyOffset).z(zIndices.stickyHeader).$, children: tableHeadRows }),
14301
14352
  /* @__PURE__ */ (0, import_jsx_runtime81.jsxs)("tbody", { children: [
14302
14353
  keptSelectedRows,
14303
- firstRowMessage && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("tr", { children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("td", { colSpan: columns.length, css: { ...style.firstRowMessageCss }, children: firstRowMessage }) }),
14354
+ firstRowMessage && /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
14355
+ "tr",
14356
+ {
14357
+ css: {
14358
+ ...tableRowPrintBreakCss,
14359
+ ...keptSelectedRows.length === 0 && style.firstBodyRowCss,
14360
+ ...visibleDataRows.length === 0 && style.lastRowCss
14361
+ },
14362
+ children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
14363
+ "td",
14364
+ {
14365
+ colSpan: columns.length,
14366
+ css: {
14367
+ ...style.betweenRowsCss,
14368
+ ...style.firstRowMessageCss,
14369
+ ...visibleDataRows.length === 0 && style.lastRowCellCss,
14370
+ ...visibleDataRows.length === 0 && style.lastRowFirstCellCss,
14371
+ ...visibleDataRows.length === 0 && style.lastRowLastCellCss
14372
+ },
14373
+ children: firstRowMessage
14374
+ }
14375
+ )
14376
+ }
14377
+ ),
14304
14378
  visibleDataRows
14305
14379
  ] })
14306
14380
  ]
@@ -14353,7 +14427,28 @@ function renderVirtual(style, id, columns, visibleDataRows, keptSelectedRows, fi
14353
14427
  if (index === 0) {
14354
14428
  return (
14355
14429
  // Ensure the fallback message is the same width as the table
14356
- /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { css: getTableRefWidthStyles(true), children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)("div", { css: { ...style.firstRowMessageCss }, children: firstRowMessage }) })
14430
+ /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
14431
+ "div",
14432
+ {
14433
+ css: {
14434
+ ...getTableRefWidthStyles(true),
14435
+ ...keptSelectedRows.length === 0 && style.firstBodyRowCss,
14436
+ ...visibleDataRows.length === 0 && style.lastRowCss
14437
+ },
14438
+ children: /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
14439
+ "div",
14440
+ {
14441
+ css: {
14442
+ ...style.firstRowMessageCss,
14443
+ ...visibleDataRows.length === 0 && style.lastRowCellCss,
14444
+ ...visibleDataRows.length === 0 && style.lastRowFirstCellCss,
14445
+ ...visibleDataRows.length === 0 && style.lastRowLastCellCss
14446
+ },
14447
+ children: firstRowMessage
14448
+ }
14449
+ )
14450
+ }
14451
+ )
14357
14452
  );
14358
14453
  }
14359
14454
  index--;
@@ -14391,20 +14486,12 @@ function renderVirtual(style, id, columns, visibleDataRows, keptSelectedRows, fi
14391
14486
  var VirtualRoot = (0, import_memoize_one.default)(
14392
14487
  (gs, _columns, id, xss) => {
14393
14488
  return import_react74.default.forwardRef(function VirtualRoot2({ style, children }, ref) {
14394
- const isHeader = Object.keys(style || {}).length === 0;
14395
14489
  return /* @__PURE__ */ (0, import_jsx_runtime81.jsx)(
14396
14490
  "div",
14397
14491
  {
14398
14492
  ref,
14399
14493
  style: { ...style, ...{ minWidth: "fit-content" } },
14400
14494
  css: {
14401
- // Add an extra `> div` due to Item + itemContent both having divs
14402
- ...Css.addIn("& > div + div > div > *", gs.betweenRowsCss || {}).$,
14403
- // Table list styles only
14404
- ...isHeader ? Css.addIn("& > div:first-of-type > *", gs.firstRowCss).$ : {
14405
- ...Css.addIn("& > div:first-of-type", gs.firstNonHeaderRowCss).$,
14406
- ...Css.addIn("& > div:last-of-type > *", gs.lastRowCss).$
14407
- },
14408
14495
  ...gs.rootCss,
14409
14496
  ...gs.minWidthPx ? Css.mwPx(gs.minWidthPx).$ : {},
14410
14497
  ...xss